{"id":26600610,"url":"https://github.com/nim-lang/vscode-nim","last_synced_at":"2025-07-05T02:34:47.382Z","repository":{"id":210043381,"uuid":"698872144","full_name":"nim-lang/vscode-nim","owner":"nim-lang","description":"A VS Code plugin for the Nim language","archived":false,"fork":false,"pushed_at":"2025-05-06T10:17:38.000Z","size":1297,"stargazers_count":93,"open_issues_count":20,"forks_count":11,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-19T20:12:19.352Z","etag":null,"topics":["nim-lang","plugin","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nim-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-01T08:27:19.000Z","updated_at":"2025-05-19T16:27:47.000Z","dependencies_parsed_at":"2023-12-11T18:42:47.328Z","dependency_job_id":"74cef523-9d27-44fc-845b-0e6eccdcd2c7","html_url":"https://github.com/nim-lang/vscode-nim","commit_stats":null,"previous_names":["nim-lang/vscode-nim"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/nim-lang/vscode-nim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nim-lang%2Fvscode-nim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nim-lang%2Fvscode-nim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nim-lang%2Fvscode-nim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nim-lang%2Fvscode-nim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nim-lang","download_url":"https://codeload.github.com/nim-lang/vscode-nim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nim-lang%2Fvscode-nim/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263671800,"owners_count":23494042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nim-lang","plugin","vscode-extension"],"created_at":"2025-03-23T18:32:13.624Z","updated_at":"2025-07-05T02:34:47.376Z","avatar_url":"https://github.com/nim-lang.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nim Extension\n\nThis extension adds language support for the Nim language to VS Code, including:\n\n* Syntax Highlight (nim, nimble, nim.cfg)\n* Code Completion\n* Signature Help\n* Goto Definition\n* Find References\n* File outline\n* Build-on-save\n* Workspace symbol search\n* Quick info\n* Problem Matchers for nim compiler and test output\n* Nim check result reported in `Nim` output channel (great for macro development)\n  ![output channel demo](images/nim_vscode_output_demo.gif \"Demo of macro evaluation in the output channel\")\u003c/details\u003e\n\n## Using\n\nFirst, you will need to install [Visual Studio Code](https://code.visualstudio.com/) `1.27.0` or higher.\nIn the command palette (`cmd-shift-p`) select `Install Extension` and choose `nim-lang.org`.\n\nThe following tools are required for the extension:\n\n* Nim compiler - http://nim-lang.org\n\n_Note_: It is recommended to turn `Auto Save` on in Visual Studio Code (`File -\u003e Auto Save`) when using this extension.\n\n### Options\n\nThe following Visual Studio Code settings are available for the Nim extension.  These can be set in user preferences (`cmd+,`) or workspace settings (`.vscode/settings.json`).\n\n* `nim.buildOnSave` - perform build task from `tasks.json` file, to use this options you need declare build task according to [Tasks Documentation](https://code.visualstudio.com/docs/editor/tasks), for example:\n\n  ```json\n  {\n      \"taskName\": \"Run module.nim\",\n      \"command\": \"nim\",\n      \"args\": [\"c\", \"-o:bin/${fileBasenameNoExtension}\", \"-r\", \"${fileBasename}\"],\n      \"options\": {\n          \"cwd\": \"${workspaceRoot}\"\n      },\n      \"type\": \"shell\",\n      \"group\": {\n          \"kind\": \"build\",\n          \"isDefault\": true\n      }\n  }\n  ```\n* `nim.lintOnSave` - perform the project check for errors on save\n* `nim.project` - optional array of projects file, if nim.project is not defined then all nim files will be used as separate project\n* `nim.licenseString` - optional license text that will be inserted on nim file creation\n* `nim.notificationTimeout` - optional the timeout in seconds for the Nim language server notifications. Use 0 to disable the timeout.\n\n#### Example\n\n```json\n{\n    \"nim.buildOnSave\": false,\n    \"nim.buildCommand\": \"c\",\n    \"nim.lintOnSave\": true,\n    \"nim.project\": [\"project.nim\", \"project2.nim\"],\n    \"nim.licenseString\": \"# Copyright 2020.\\n\\n\"\n}\n```\n\n### Commands\n\nThe following commands are provided by the extension:\n\n* `Nim: Run selected file` - compile and run selected file, it uses `c` compiler by default, but you can specify `cpp` in `nim.buildCommand` config parameter.\nThis command available from file context menu or by `F6` keyboard shortcut.\n\n* `Nim: Restart nimsuggest` - restart `nimsuggest` process when using `nimsuggest`.\n---\n\n### Debugging\n\nVisual Studio Code includes a powerful debugging system, and the Nim tooling can take advantage of that. However, in order to do so, some setup is required.\n\n#### Setting up\n\nFirst, install a debugging extension, such as [CodeLLDB](https://open-vsx.org/extension/vadimcn/vscode-lldb), and any native packages the extension may require (such as clang and LLDB).\n\nNext, you need to create a `tasks.json` file for your project, under the `.vscode` directory of your project root. Here is an example for CodeLLDB:\n\n```jsonc\n// .vscode/tasks.json\n{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"nim: build current file (for debugging)\",\n            \"command\": \"nim\",\n            \"args\": [\n                \"compile\",\n                \"-g\",\n                \"--debugger:native\",\n                \"-o:${workspaceRoot}/bin/${fileBasenameNoExtension}\",\n                \"${relativeFile}\"\n            ],\n            \"options\": {\n                \"cwd\": \"${workspaceRoot}\"\n            },\n            \"type\": \"shell\",\n        }\n    ]\n}\n```\n\nThen, you need to create a launch configuration in the project's launch.json file. Again, this example works with CodeLLDB:\n\n```jsonc\n// .vscode/launch.json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"type\": \"lldb\",\n            \"request\": \"launch\",\n            \"name\": \"nim: debug current file\",\n            \"preLaunchTask\": \"nim: build current file (for debugging)\",\n            \"program\": \"${workspaceFolder}/bin/${fileBasenameNoExtension}\",\n            \"args\": [],\n            \"cwd\": \"${workspaceFolder}\",\n        }\n    ]\n}\n```\n\nYou should be set up now to be able to debug from a given file in the native VS Code(ium) debugger.\n\n![Debugger preview screenshot](images/debugging-screenshot.png \"debugger preview\")\n\n---\n\n## [Experimental] Test runner\n\nThe extension also support running tests. The project must be using `unittest2 \u003e= 0.2.4` and a test entry point must be defined in the settings `nim.test.entryPoint`. Alternativaly, one can use the `testEntryPoint` setting from `nimble` (starting at `nimble 0.20.0`). \n\n\nTests will be listed in the vscode Test Explorer. There is a command `Refresh Tests` that re-runs test listing. \n\n![Test runner screenshot](images/testrunner.png \"test runner\")\n\n\n---\n\n## Code Completion\n\nThis extension relies on the Nim Language Server for code completion. You can read more about it [here](https://github.com/nim-lang/langserver)\n\n---\n\n## Developing the Extension\n\n* If this is the first time you're building the extension on your machine, do an npm install to get the dependencies\n* You should also copy (or create a symlink to) the `nimsuggest` directory from the Nim compiler sources into `src/nimsuggest`\n* Press `F5` or whatever your `Run -\u003e Start Debugging` command short cut is\n* If prompted choose launch `Extension`\n* This launches a new VS Code Window which is running your patched extension\n* You can open a Nim code base to try it out\n  * If you want to try it out on the extension source itself, create a new workspace and add the source as a folder to the workspace so VS Code doesn't take you back to the development window\n\nAlternatively, feel free to give side-loading a shot.\n\n### Side-loading the Extension\n\n* Run `nimble vsix` to build the extension package to `out/nimvscode-\u003cversion\u003e.vsix`\n* Run `nimble install_vsix` if you have VS Code on `PATH`, otherwise select `Install from VSIX` from the command palette (`cmd-shift-p`) and choose `out/nimvscode-\u003cversion\u003e.vsix`.\n\n---\n\n## Acknowledgments\n\nThis extension started out as a fork of the @saem extension [vscode-nim](https://github.com/saem/vscode-nim) which was a port of an extension written in [TypeScript](https://marketplace.visualstudio.com/items?itemName=kosz78.nim) for the Nim language.\n\nThank you Saem for your work and letting us build on top of it.\n\n## Roadmap\n\nThe roadmap is located [here](https://github.com/nim-lang/RFCs/issues/544)\n\n## ChangeLog\n\nChangeLog is located [here](https://github.com/nim-lang/vscode-nim/blob/main/CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnim-lang%2Fvscode-nim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnim-lang%2Fvscode-nim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnim-lang%2Fvscode-nim/lists"}