Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ The extension launches the LSP automatically using the `ndc` binary. If `ndc` is
that VS Code uses (common when installed via a shell like fish), set the `andy-cpp.ndcPath` setting
to the full path of the binary.

### JetBrains IDEs (RustRover, IntelliJ, …)

JetBrains IDEs are supported by importing `ext/andy-cpp` as a TextMate bundle (syntax
highlighting) and connecting the LSP4IJ plugin to `ndc lsp` (diagnostics, hover,
completion, inlay type hints, go to definition). See the
[editor support page](https://timfennis.github.io/andy-cpp/tooling/editor-support.html)
in the manual for setup instructions.

### Other editors

If you prefer a different editor, you can start the language server manually over stdio:

```bash
Expand Down
12 changes: 11 additions & 1 deletion ext/andy-cpp/syntaxes/andy-cpp.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{
"comment": "function definition",
"name": "meta.function.definition.andy-cpp",
"begin": "\\b((pure)\\s)?(fn)\\s+([A-Za-z_][A-Za-z_0-9]*)",
"begin": "\\b((pure)\\s)?(fn)\\s+([A-Za-z_][A-Za-z_0-9]*\\??)",
"patterns": [
{
"include": "#expression"
Expand Down Expand Up @@ -126,11 +126,21 @@
"begin": "(//)",
"end": "$",
"name": "comment.line.double-slash.andy-cpp"
},
{
"begin": "(#!)",
"end": "$",
"name": "comment.line.shebang.andy-cpp"
}
]
},
"numbers": {
"patterns": [
{
"comment": "Complex literals (imaginary part), e.g. `3i` or `2.5j`",
"match": "\\b([0-9][0-9_]*(\\.[0-9][0-9_]*)?[ij])\\b",
"name": "constant.numeric.complex.andy-cpp"
},
{
"comment": "Floats",
"match": "\\b([0-9][0-9_]*\\.[0-9][0-9_]*)\\b",
Expand Down
17 changes: 17 additions & 0 deletions ext/lsp4ij-ndc/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Andy C++ (ndc)",
"programArgs": {
"default": "ndc lsp --stdio"
},
"fileTypeMappings": [
{
"fileType": {
"name": "ndc",
"patterns": [
"*.ndc"
]
},
"languageId": "ndc"
}
]
}
26 changes: 26 additions & 0 deletions manual/src/tooling/editor-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ launches it automatically. Any LSP-capable editor can use it by pointing at the
variable declarations in the file.
- **Go-to-definition** β€” jump from a variable or function usage to its declaration.

## JetBrains IDEs (RustRover, IntelliJ, …)

JetBrains IDEs are supported without a dedicated plugin, in two independent parts.

**Syntax highlighting** β€” the bundled *TextMate Bundles* plugin can import the VS Code
extension directory directly:

1. Go to *Settings β†’ Editor β†’ TextMate Bundles*, click **+**, and select the
`ext/andy-cpp` directory from the repository.
2. Open a `.ndc` file β€” it should highlight immediately. If it renders as plain text,
check *Settings β†’ Editor β†’ File Types* and make sure `*.ndc` is not claimed by
another file type.

**Language intelligence** β€” the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij)
plugin connects the IDE to the language server:

1. Build the binary with `cargo build --release`, then install **LSP4IJ** from the
plugin marketplace.
2. Open the *Language Servers* tool window, click **+**, and configure a new server:
- **Command**: `/path/to/andy-cpp/target/release/ndc lsp --stdio`
- In the **Mappings** tab, add a *File name patterns* mapping with pattern `*.ndc`
and language id `ndc`.
3. Open a `.ndc` file. The server starts automatically and provides everything listed
above. `ext/lsp4ij-ndc/template.json` in the repository contains the same
configuration as a reference.

## Notes

- The server uses full-document synchronisation and re-analyses on each edit.
Expand Down
Loading