Add guide
This commit is contained in:
parent
78625d3b97
commit
225f9f4466
3
.envrc
3
.envrc
|
@ -3,7 +3,6 @@
|
|||
source ./scripts/rebuild-nim
|
||||
source ./scripts/rebuild-nimble
|
||||
|
||||
export NIMBLE_DIR="$(pwd)/.nimble"
|
||||
export PATH="$(pwd)/bin:$(realpath ~/.cache/nim-workspace/bin/):$NIMBLE_DIR/bin:$(pwd)/${NIM_DIR}/bin:$(pwd)/scripts:${PATH}"
|
||||
export PATH="$(pwd)/bin:$(realpath ~/.cache/nim-workspace/bin/):$HOME/.nimble/bin:$(pwd)/${NIM_DIR}/bin:$(pwd)/scripts:${PATH}"
|
||||
|
||||
source ./scripts/rebuild-languageserver
|
||||
|
|
50
README.md
50
README.md
|
@ -14,6 +14,56 @@ instructions here:
|
|||
|
||||
https://github.com/direnv/direnv
|
||||
|
||||
### VScode
|
||||
|
||||
For VScode you have to install the following [extension](https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode)
|
||||
|
||||
## Development workflows
|
||||
|
||||
### Configuring your IDE/editor
|
||||
|
||||
Once you have `direnv` installed you can fire up your editor from the terminal.
|
||||
Note for the editors that have support for `direnv` you don't need to start the
|
||||
editor from the terminal.
|
||||
|
||||
Here it is sample configuration for the `nim-codex` project `VScode`(it should
|
||||
be placed in `nim-workspace/.vscode/settings.json`).
|
||||
|
||||
``` json
|
||||
{
|
||||
"nim.provider": "lsp", // force using lsp over nimsuggest integration
|
||||
"nim.lintOnSave": false, // disable nim-check
|
||||
"nim.autoCheckProject": true, // you might want to set that to false for big projects. It will disable project compilation after saving a file.
|
||||
"nim.projectMapping": [{
|
||||
"projectFile": "nim-codex/codex.nim",
|
||||
"fileRegex": ".*\\.nim$" // force all files to be opened with once nimsuggest instance
|
||||
}],
|
||||
"nim.workingDirectoryMapping": [{
|
||||
"projectFile": "nim-codex/codex.nim",
|
||||
"directory": "nim-codex" // start nimsuggest for nim-codex/codex.nim in nim-codex folder
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `nim.provider: "lsp"` - force using lsp over nimsuggest integration
|
||||
- `nim.lintOnSave: false` - disable `nim check` in vscode
|
||||
- `nim.autoCheckProject: true` - you might want to set that to `false` for big
|
||||
projects. It will disable project compilation after saving a file. In case
|
||||
this is disabled you may force that using `C-S-p Source Actions RET` and pick
|
||||
`Compile project`.
|
||||
- `nim.projectMapping`: configure how `nimsuggest` instances can be started.
|
||||
The value in the sample section will force all nim files to be opened with the
|
||||
same `nimsuggest` instance.
|
||||
- `nim.workingDirectoryMapping` - the mapping is used to determine which
|
||||
directory to start `nimsuggest`(typically it is the actual project root, but
|
||||
`nimlangserver` can't guess that).
|
||||
|
||||
_NB:_ make sure that you have imported the whole `nim-workspace` as a Workspace
|
||||
folder in `VScode`. if you don't do that you have to adjust the values in the
|
||||
settings file to strip the project name (i. e. `nim-codex`).
|
||||
|
||||
## Commands
|
||||
|
||||
### `add-project <project-name>`
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f "$NIMBLE_DIR/bin/nimlangserver" ] ; then
|
||||
if [ ! -f "$HOME/.nimble/bin/nimlangserver" ] ; then
|
||||
nimble install -y nimlangserver
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue