From: Brendan Hansen Date: Fri, 12 May 2023 20:02:06 +0000 (-0500) Subject: added: environment setup page X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=e5360789fc91690b379ee733354354e2eee2e47e;p=onyxlang.io.git added: environment setup page --- diff --git a/onyx-pkg.ini b/onyx-pkg.ini index b320fce..4960205 100644 --- a/onyx-pkg.ini +++ b/onyx-pkg.ini @@ -17,15 +17,11 @@ build_cmd= library= [dependencies] -git://onyxlang.io/repo/http-server=0.2.0 -git://onyxlang.io/repo/postgres-orm=0.0.25 -git://onyxlang.io/repo/otmp=0.0.8 -git://onyxlang.io/repo/postgres=0.0.10 +git://onyxlang.io/repo/http-server=0.2.1 +git://onyxlang.io/repo/otmp=0.0.9 [dependency_folders] git://onyxlang.io/repo/http-server=http-server -git://onyxlang.io/repo/postgres-orm=postgres-orm -git://onyxlang.io/repo/base64=base64 -git://onyxlang.io/repo/postgres=postgres git://onyxlang.io/repo/otmp=otmp +git://onyxlang.io/repo/base64=base64 diff --git a/src/app.onyx b/src/app.onyx index 4752b63..49408c5 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -36,6 +36,9 @@ reg: otmp.TemplateRegistry; @route.{.GET, "/docs/install"} (req: &Req, res: &Res) => res->render("pages/docs/install", null); +@route.{.GET, "/docs/setup"} +(req: &Req, res: &Res) => res->render("pages/docs/setup", null); + Article :: struct { name, description, path, date: str } news_articles: Cached_Resource([] Article); diff --git a/www/static/css/new_style.css b/www/static/css/new_style.css index 325b25d..7c9ff3b 100644 --- a/www/static/css/new_style.css +++ b/www/static/css/new_style.css @@ -306,12 +306,13 @@ main { } main pre { - border: 1px solid var(--terminal-background-color); - box-shadow: 0px 1px 10px 1px rgba(0, 0, 0, 0.2); + border: 2px solid var(--dark-background-color); + border-radius: 4px; + box-shadow: 0px 1px 6px 1px rgba(0, 0, 0, 0.2); padding: 8px; display: block; - overflow-y: scroll; - overflow-x: scroll; + overflow-y: auto; + overflow-x: auto; } pre code { diff --git a/www/templates/pages/docs.html b/www/templates/pages/docs.html index 566a4dc..a1443d8 100644 --- a/www/templates/pages/docs.html +++ b/www/templates/pages/docs.html @@ -12,7 +12,8 @@ Install Onyx locally on your system, or use it in your browser.

- 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" }} + +
+

Setting Up Your Environment for Onyx

+

+ LSP + Vim / Neovim + VS Code + Sublime text + Emacs +

+
+ +
+

Language Server

+

+ 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. +

+ +

Installing the Language Server

+
    +
  1. On Linux or Windows Subsystem for Linux, clone the onyx-lsp repository.
  2. +
  3. Go into the run_tree folder.
  4. +
  5. Run chmod +x onyx-lsp install, then ./install.
  6. +
  7. Test the installation by running onyx-lsp. If the command is found and running, you're good to go.
  8. +
+ +

Neovim

+

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
+}
+ +

Visual Studio Code

+

Installing the extension automatically enables the language server in VS Code.

+ +

Sublime Text

+

+ 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"
+    }
+  }
+}
+
+ +
+

Vim / Neovim

+

+ 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. +

+
+ +
+

Visual Studio Code

+

+ 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,

+
    +
  1. Hit "Control+Shift+P" on Windows/Linux, or "Command+Shift+P" on MacOS.
  2. +
  3. Search for and select "Extensions: Install from VSIX".
  4. +
  5. Go to the downloaded copy of Onyx and select the newest version of the Onyx extension in misc/vscode. +
  6. Restart VS Code.
  7. +
+ +

This extension does have support for the onyx-lsp, assuming that is setup. +

+ +
+

Sublime Text

+

+ 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. +

+
+ +
+

Emacs

+

+ 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. +

+
+ + +{{ endblock }} + +{{ extends "pages/normal_page" }}