Skip to content

pragmagic/vscode-nim

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 20, 2018 23:27
December 10, 2018 21:58
January 15, 2019 21:54
April 15, 2017 20:02
September 20, 2018 23:27
September 27, 2017 22:54
September 20, 2018 23:27
February 15, 2016 18:26
August 17, 2020 12:02
September 20, 2018 23:27

Nim for Visual Studio Code

Version Installs Ratings Build Status

This extension adds language support for the Nim language to VS Code, including:

  • Syntax Highlight (nim, nimble, nim.cfg)
  • Code Completion
  • Signature Help
  • Goto Definition
  • Find References
  • File outline
  • Build-on-save
  • Workspace symbol search
  • Quick info
  • Nim check result reported in Nim output channel (great for macro development).

output channel demo

Using

First, you will need to install Visual Studio Code 0.10. In the command palette (cmd-shift-p) select Install Extension and choose Nim.

The following tools are required for the extension:

Note: It is recommended to turn Auto Save on in Visual Studio Code (File -> Auto Save) when using this extension.

Options

The 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).

  • nim.buildOnSave - perform build task from tasks.json file, to use this options you need declare build task according to Tasks Documentation, for example:
     {
        "taskName": "Run module.nim",
        "command": "nim",
        "args": ["c", "-o:bin/${fileBasenameNoExtension}", "-r", "${fileBasename}"],
        "options": {
           "cwd": "${workspaceRoot}"
        },
        "type": "shell",
        "group": {
           "kind": "build",
           "isDefault": true
        }
     }
  • nim.lintOnSave - perform the project check for errors on save
  • nim.project - optional array of projects file, if nim.project is not defined then all nim files will be used as separate project
  • nim.licenseString - optional license text that will be inserted on nim file creation

Example

{
	"nim.buildOnSave": false,
	"nim.buildCommand": "c",
	"nim.lintOnSave": true,
	"nim.project": ["project.nim", "project2.nim"],
	"nim.licenseString": "# Copyright 2017.\n\n"
}

Commands

The following commands are provided by the extension:

  • 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. This command available from file context menu or by F6 keyboard shortcut.

TODO

  • Rename support
  • Debug support

ChangeLog

ChangeLog is located here