added: environment setup page
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 12 May 2023 20:02:06 +0000 (15:02 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 12 May 2023 20:02:06 +0000 (15:02 -0500)
onyx-pkg.ini
src/app.onyx
www/static/css/new_style.css
www/templates/pages/docs.html
www/templates/pages/docs/setup.html [new file with mode: 0644]

index b320fce46e55fef0b7e57f36f974cae3dc64c34b..496020526b49b3bc3648e62e66dc1a9eed8b0dbc 100644 (file)
@@ -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
 
index 4752b636500628ff931a2c89f7ae7a797aeabe6e..49408c592756db42c4a18af4b7f27c9ce994885b 100644 (file)
@@ -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);
index 325b25d9a114df212b872741c9f4196b5f779896..7c9ff3b582b7fff86ce65576427e3ac01546d2ea 100644 (file)
@@ -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 {
index 566a4dc2a051e872605cacb037220e8d2f82260a..a1443d8bbd4ce731435d1a117a1a79cad06e0af4 100644 (file)
@@ -12,7 +12,8 @@
     Install Onyx locally on your system, or use it in your browser.
     </p>
     <p>
-    <a class="link-button"href="/docs/install">Install</a>
+    <a class="link-button" href="/docs/install">Install</a>
+    <a class="link-button" href="/docs/setup">Environment Setup</a>
     <a class="link-button" href="/playground/">Playground</a>
     </p>
 </div>
diff --git a/www/templates/pages/docs/setup.html b/www/templates/pages/docs/setup.html
new file mode 100644 (file)
index 0000000..f20ed39
--- /dev/null
@@ -0,0 +1,128 @@
+{{block "title"}}Onyx Environment Setup{{endblock}}
+
+{{ block "page_content" }}
+
+<div class="container">
+    <h1>Setting Up Your Environment for Onyx</h1>
+    <p>
+        <a class="link-button" href="#lsp">LSP</a>
+        <a class="link-button" href="#vim">Vim / Neovim</a>
+        <a class="link-button" href="#vscode">VS Code</a>
+        <a class="link-button" href="#sublime-text">Sublime text</a>
+        <a class="link-button" href="#emacs">Emacs</a>
+    </p>
+</div>
+
+<div class="container" id="lsp">
+    <h2>Language Server</h2>
+    <p>
+    If you are unfamiliar, a <em>Language Server</em> 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.
+    </p>
+
+    <p>
+    At the time of writing, the language server for onyx (<code>onyx-lsp</code>), is only supported on Linux.
+    This will be addressed soon.
+    </p>
+
+    <h3>Installing the Language Server</h3>
+    <ol>
+        <li>On Linux or Windows Subsystem for Linux, clone the <a href="https://github.com/onyx-lang/onyx-lsp">onyx-lsp</a> repository.</li>
+        <li>Go into the <code>run_tree</code> folder.</li>
+        <li>Run <code>chmod +x onyx-lsp install</code>, then <code>./install</code>.</li>
+        <li>Test the installation by running <code>onyx-lsp</code>. If the command is found and running, you're good to go.</li>
+    </ol>
+
+    <h3>Neovim</h3>
+    <p>To use the language server in NeoVim, you need to have <a href="https://github.com/neovim/nvim-lspconfig">the NeoVim lspconfig package</a> installed.</p>
+    <p>Then, you need the following in your NeoVim configuration somewhere:</p>
+    <pre class="hljs"><code class="language-lua">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
+}</code></pre>
+
+    <h3>Visual Studio Code</h3>
+    <p>Installing the extension automatically enables the language server in VS Code.</p>
+
+    <h3>Sublime Text</h3>
+    <p>
+        Install the <code>LSP</code> package, and add the following custom configuration.
+        See more information on <a href="https://lsp.sublimetext.io">the LSP package docs</a>.
+    </p>
+    <pre class="hljs"><code class="language-json">{
+  "clients": {
+    "onyx": {
+      "enabled": true,
+      "command": ["onyx-lsp"],
+      "selector": "source.onyx"
+    }
+  }
+}</pre></code>
+</div>
+
+<div class="container light" id="vim">
+    <h2>Vim / Neovim</h2>
+    <p>
+    Follow the instructions on the <a href="https://github.com/onyx-lang/onyx.vim">onyx.vim</a> GitHub repo.
+    </p>
+
+    <p>
+    Note, that this extension currently does not setup the LSP, and that must be done separately.
+    </p>
+</div>
+
+<div class="container" id="vscode">
+    <h2>Visual Studio Code</h2>
+    <p>
+    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 <code>misc/vscode</code> folder, which contains multiple versions of the Onyx extension.
+    </p>
+
+    <p>To install the extension in VS Code,</p>
+    <ol>
+        <li>Hit "Control+Shift+P" on Windows/Linux, or "Command+Shift+P" on MacOS.</li>
+        <li>Search for and select "Extensions: Install from VSIX".</li>
+        <li>Go to the downloaded copy of Onyx and select the newest version of the Onyx extension in <code>misc/vscode</code>.
+        <li>Restart VS Code.</li>
+    </ol>
+
+    <p>This extension does have support for the <code>onyx-lsp</code>, assuming that is setup.
+</div>
+
+<div class="container light" id="sublime-text">
+    <h2>Sublime Text</h2>
+    <p>
+    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 <code>misc</code> folder, there is a file called <code>onyx.sublime-syntax</code>. Simply copy this into the <code>Packages/User</code> folder for Sublime Text. See more details <a href="https://www.sublimetext.com/docs/packages.html">here</a>.
+    </p>
+</div>
+
+<div class="container" id="emacs">
+    <h2>Emacs</h2>
+    <p>
+    Currently, Onyx does not have a published package for Emacs. In the <code>misc</code> folder, there is an Emacs Lisp file that provides an <code>onyx-mode</code>. You should be able to load it into your Emacs config and enable <code>onyx-mode</code> to get syntax highlighting.
+    </p>
+</div>
+
+
+{{ endblock }}
+
+{{ extends "pages/normal_page" }}