-
Notifications
You must be signed in to change notification settings - Fork 298
Features
Oni utilizes the Language Server Protocol (LSP) to provide common IDE functionality for any arbitrary programming language. This enables features like code completion, go-to definition, and method signature help.
Language options are configurable via the configuration settings in your config.js
.
In general, language options are specified in the form language.<language-identifier>.<option>
, where language-identifier
corresponds to the file type.
Language servers are configurable via the language.<language-identifier>.languageServer.<setting>
, and the following settings are available:
-
command
- (String) (required) - The command to start the language server. This could be a javascript file or an executable. REQUIRED -
arguments
(String[]) (optional) - An array of arguments to pass to the language server -
rootFiles
(String) (optional) - A set of files that are treated as the root. When this is specified, Oni will search upward for this, and start the language server in the root folder -
configuration
(any) (optional) - Additional javascript objects to send to the language server via theworkspace/onConfigurationChanged
event
An example configuration might be:
"language.reason.languageServer.command": "ocaml-language-server",
"language.reason.languageServer.arguments": ["--stdio"],
"language.reason.languageServer.rootFiles": [".merlin, bsconfig.json"],
"language.reason.languageServer.configuration": {}
The only required option is the language server command, however, some language servers may require you to use the full set of parameters.
NOTE: Language servers implement different transports -
stdio
,ipc
,socket
. Today, Oni only supportsstdio
To find a language server, check out langserver.org
Aside from language servers, there are other settings available for customizing languages in Oni:
-
language.<language-identifier>.completionTriggerCharacters
(string[]
) - an array of characters that can trigger completion. -
NOT IMPLEMENTED YET -
language.<language-identifier>.autoPairs
JavaScript and TypeScript support is enabled out-of-the-box using the TypeScript Standalone Server. No setup and configuration is necessary, however, you will get better results if you use a tsconfig.json
or a jsconfig.json
to structure your project.
C and C++ language support is set up by default to use clangd
, and expects clangd
available in your path.
- Get a working
clangd
(both code and executables are available here) - Make sure that
clangd
is available globally (for instance, by adding it to an environment variable)
For information on setting it up, please refer to the clangd documentation.
C# language support is not configured by default, and requires the oni-language-csharp plugin, which provides language capabilities for both .NET and Mono.
Follow the installation instructions to get started.
Go language support depends on the go-langserver by SourceGraph, which provides language support for Go. Follow their installation instructions as this language server is not bundled out-of-the-box with Oni.
go-langserver
must be available in your PATH. You can override this by setting thegolang.langServerCommand
configuration value.
Known Issues
- There is no Windows support at the moment - this is being tracked by sourcegraph/go-langserver#113.
Python language support depends on pyls by Palantir, which provides language support for Python. Follow their installation instructions as this language server is not bundled out-of-the-box with Oni.
pyls
must be available in your PATH. You can override this by setting thepython.langServerCommand
configuration value.
Oni comes with ocaml-language-server
out-of-the-box, however, make sure you have the other pre-requisites installed and that merlin is configured properly.