From: Brendan Hansen
- Install + Install + Environment Setup Playground
diff --git a/www/templates/pages/docs/setup.html b/www/templates/pages/docs/setup.html new file mode 100644 index 0000000..f20ed39 --- /dev/null +++ b/www/templates/pages/docs/setup.html @@ -0,0 +1,128 @@ +{{block "title"}}Onyx Environment Setup{{endblock}} + +{{ block "page_content" }} + ++ LSP + Vim / Neovim + VS Code + Sublime text + Emacs +
++ If you are unfamiliar, a Language Server abstracts the tooling and language specific functionality out of editors and into a reusable component. + This way, it is easier to develop in-editor functionality across multiple editors, as the same work does not need to be replicated for each supported editor. +
+ +
+ At the time of writing, the language server for onyx (onyx-lsp
), is only supported on Linux.
+ This will be addressed soon.
+
run_tree
folder.chmod +x onyx-lsp install
, then ./install
.onyx-lsp
. If the command is found and running, you're good to go.To use the language server in NeoVim, you need to have the NeoVim lspconfig package installed.
+Then, you need the following in your NeoVim configuration somewhere:
+local lspconfig = require 'lspconfig'
+local configs = require 'lspconfig.configs'
+
+configs.onyx = {
+ default_config = {
+ cmd = { "onyx-lsp" },
+ filetypes = { "onyx" },
+ root_dir = function(filename)
+ local utils = require "lspconfig.util"
+ return utils.search_ancestors(filename, function(path)
+ if utils.path.is_file(utils.path.join(path, "onyx-lsp.ini")) then
+ return path
+ end
+ end)
+ end;
+ settings = {}
+ }
+}
+
+lspconfig.onyx.setup {
+ on_attach = function(client)
+ print("Onyx LSP started.")
+ end
+}
+
+ Installing the extension automatically enables the language server in VS Code.
+ +
+ Install the LSP
package, and add the following custom configuration.
+ See more information on the LSP package docs.
+
{
+ "clients": {
+ "onyx": {
+ "enabled": true,
+ "command": ["onyx-lsp"],
+ "selector": "source.onyx"
+ }
+ }
+}
++ Follow the instructions on the onyx.vim GitHub repo. +
+ ++ Note, that this extension currently does not setup the LSP, and that must be done separately. +
+
+ Currently, Onyx does not have a published extension for Visual Studio Code, but you are able to install it manually. In your downloaded or cloned copy of Onyx, there is a misc/vscode
folder, which contains multiple versions of the Onyx extension.
+
To install the extension in VS Code,
+misc/vscode
.
+ This extension does have support for the onyx-lsp
, assuming that is setup.
+
+ Currently, Onyx does not have a published package on Sublime Text's Package Control, but like VS Code, you are able to install it manually. In the misc
folder, there is a file called onyx.sublime-syntax
. Simply copy this into the Packages/User
folder for Sublime Text. See more details here.
+
+ Currently, Onyx does not have a published package for Emacs. In the misc
folder, there is an Emacs Lisp file that provides an onyx-mode
. You should be able to load it into your Emacs config and enable onyx-mode
to get syntax highlighting.
+