Merge pull request #218 from nyaa8/github-readme

GitHub README improvements and assets clean-ups
This commit is contained in:
Alexandros Naskos 2021-01-15 11:26:58 +02:00 committed by GitHub
commit 2a968f51d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 214 additions and 87 deletions

View File

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="zls.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
id="svg8"
version="1.1"
viewBox="0 0 73.944016 37.80486"
height="142.88449"
width="279.47348">
<defs
id="defs2" />
<sodipodi:namedview
showguides="false"
units="px"
inkscape:window-maximized="1"
inkscape:window-y="15"
inkscape:window-x="5132"
inkscape:window-height="2067"
inkscape:window-width="1887"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="mm"
inkscape:cy="185.27101"
inkscape:cx="233.87099"
inkscape:zoom="1.4"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
fit-margin-top="2.558"
fit-margin-bottom="2.558"
fit-margin-left="2.509"
fit-margin-right="2.509" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1"
transform="translate(4.4419096e-4,-2.7117153e-4)">
<text
id="text967"
y="12.207294"
x="1.938048"
style="font-style:normal;font-weight:normal;font-size:12.7px;line-height:0.9;font-family:sans-serif;letter-spacing:-2.64583px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
xml:space="preserve"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.7px;font-family:Inter, sans-serif;-inkscape-font-specification:'Inter Bold';letter-spacing:0px;fill:#f7a41d;fill-opacity:1;stroke-width:0.264583"
y="12.207294"
x="1.938048"
id="tspan965">Zig</tspan><tspan
id="tspan977"
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.7px;font-family:Inter, sans-serif;-inkscape-font-specification:'Inter Bold';letter-spacing:0px;fill:#000000;fill-opacity:1;stroke-width:0.264583"
y="23.637295"
x="1.938048">Language</tspan><tspan
id="tspan984"
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.7px;font-family:Inter, sans-serif;-inkscape-font-specification:'Inter Bold';letter-spacing:0px;fill:#000000;fill-opacity:1;stroke-width:0.264583"
y="35.067295"
x="1.938048">Server</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

207
.github/README.md vendored Normal file
View File

@ -0,0 +1,207 @@
![Zig Language Server](./assets/zls.svg)
![CI](https://github.com/zigtools/zls/workflows/CI/badge.svg)
![Zig Tools](./assets/zigtools.svg)
Zig Language Server, or `zls`, is a language server for Zig. The Zig wiki states that "The Zig community is decentralized" and "There is no concept of 'official' or 'unofficial'", so instead of calling `zls` unofficial, and I'm going to call it a cool option, one of [many](https://github.com/search?q=zig+language+server).
<!-- omit in toc -->
## Table Of Contents
- [Installation](#installation)
- [Build Options](#build-options)
- [Configuration Options](#configuration-options)
- [Usage](#usage)
- [VSCode](#vscode)
- [Sublime Text 3](#sublime-text-3)
- [Kate](#kate)
- [Neovim/Vim8](#neovimvim8)
- [Emacs](#emacs)
- [Related Projects](#related-projects)
- [License](#license)
## Installation
Installation starts with downloading an official release from the [Releases page](https://github.com/zigtools/zls/releases).
See [Downloading and Building ZLS](https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS) on the Wiki, or the page about [using ZLS with Visual Studio Code](https://github.com/zigtools/zls/wiki/Installing-for-Visual-Studio-Code) for a guide to help get `zls` running in your editor.
### From Source
Building `zls` is very easy. You will need [a build of Zig master](https://ziglang.org/download/) to build zls.
```bash
git clone --recurse-submodules https://github.com/zigtools/zls
cd zls
zig build -Drelease-safe
zig build config # Configure ZLS
```
*For detailed building instructions, see the Wiki page about [Cloning With Git](https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS#cloning-with-git).*
#### Build Options
<!-- When updating this table, be sure to copy changes to the Wiki page about building from source. -->
<!-- If this table grows too large, then delete this one and move it all over to the Wiki page about building from source. -->
| Option | Type | Default Value | What it Does |
| --- | --- | --- | --- |
| `-Ddata_version` | `string` (master or 0.7.0) | master | The data file version. This selects the files in the `src/data` folder that correspond to the Zig version being served.|
### Configuration Options
You can configure zls by providing a zls.json file.
zls will look for a zls.json configuration file in multiple locations with the following priority:
- In the local configuration folder of your OS (as provided by [known-folders](https://github.com/ziglibs/known-folders#folder-list))
- In the same directory as the executable
The following options are currently available.
| Option | Type | Default value | What it Does |
| --- | --- | --- | --- |
| `enable_snippets` | `bool` | `false` | Enables snippet completions when the client also supports them. |
| `zig_lib_path` | `?[]const u8` | `null` | zig library path, e.g. `/path/to/zig/lib/zig`, used to analyze std library imports. |
| `zig_exe_path` | `?[]const u8` | `null` | zig executable path, e.g. `/path/to/zig/zig`, used to run the custom build runner. If `null`, zig is looked up in `PATH`. Will be used to infer the zig standard library path if none is provided. |
| `warn_style` | `bool` | `false` | Enables warnings for style *guideline* mismatches |
| `build_runner_path` | `?[]const u8` | `null` | Path to the build_runner.zig file provided by zls. `null` is equivalent to `${executable_directory}/build_runner.zig` |
| `build_runner_cache_path` | `?[]const u8` | `null` | Path to a directroy that will be used as zig's cache when running `zig run build_runner.zig ...`. `null` is equivalent to `${KnownFloders.Cache}/zls` |
| `enable_semantic_tokens` | `bool` | `true` | Enables semantic token support when the client also supports it. |
| `operator_completions` | `bool` | `true` | Enables `*` and `?` operators in completion lists. |
## Features
`zls` supports most language features, including simple type function support, usingnamespace, payload capture type resolution, custom packages and others.
Notable language features that are not currently implemented include `@cImport` as well as most forms of compile time evaluation.
The following LSP features are supported:
- Completions
- Hover
- Goto definition/declaration
- Document symbols
- Find references
- Rename symbol
- Formatting using `zig fmt`
- Semantic token highlighting (LSP 3.16 proposed feature, implemented by a few clients including VSCode, kak and emacs lsp-mode)
You can install `zls` using the instuctions for your text editor below:
### VSCode
Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-vscode/releases) and provide a path to the build `zls` executable.
### Sublime Text 3
- Install the `LSP` package from [here](https://github.com/sublimelsp/LSP/releases) or via Package Control.
- Add this snippet to `LSP's` user settings:
```json
{
"clients": {
"zig":{
"command": ["zls"],
"enabled": true,
"languageId": "zig",
"scopes": ["source.zig"],
"syntaxes": ["Packages/Zig Language/Syntaxes/Zig.tmLanguage"]
}
}
}
```
### Kate
- Enable `LSP client` plugin in Kate settings.
- Add this snippet to `LSP client's` user settings (e.g. /$HOME/.config/kate/lspclient)
(or paste it in `LSP client's` GUI settings)
```json
{
"servers": {
"zig": {
"command": ["zls"],
"url": "https://github.com/zigtools/zls",
"highlightingModeRegex": "^Zig$"
}
}
}
```
### Neovim/Vim8
#### CoC
- Install the CoC engine from [here](https://github.com/neoclide/coc.nvim).
- Issue `:CocConfig` from within your Vim editor, and the following snippet:
```json
{
"languageserver": {
"zls" : {
"command": "command_or_path_to_zls",
"filetypes": ["zig"]
}
}
}
```
#### nvim-lspconfig
Requires Nvim 0.5 (HEAD)!
- Install nvim-lspconfig from [here](https://github.com/neovim/nvim-lspconfig).
- Install zig.vim from [here](https://github.com/ziglang/zig.vim).
nvim-lspconfig already ships a configuration for zls. A simple `init.vim` might look like this:
```vim
call plug#begin('~/.config/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'
Plug 'ziglang/zig.vim'
call plug#end()
:lua << EOF
local lspconfig = require('lspconfig')
local on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
require('completion').on_attach()
end
local servers = {'zls'}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
}
end
EOF
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Enable completions as you type
let g:completion_enable_auto_popup = 1
```
### Emacs
- Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) from melpa
- [zig mode](https://github.com/ziglang/zig-mode) is also useful
```elisp
(require 'lsp)
(add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "<path to zls>")
:major-modes '(zig-mode)
:server-id 'zls))
```
## Related Projects
- [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language)
- Supports basic language features
- Uses data provided by `src/data` to perform builtin autocompletion
- [`zig-lsp` by @xackus](https://github.com/xackus/zig-lsp)
- Inspiration for `zls`
- [`known-folders` by @ziglibs](https://github.com/ziglibs/known-folders)
- Provides API to access known folders on Linux, Windows and Mac OS
## License
MIT

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

1
.github/assets/zigtools.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="181" height="20" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 181 20"><path fill="url(#1)" d="M70 0H3C1.343 0 0 1.343 0 3v14c0 1.657 1.343 3 3 3h67V0z"/><path fill="url(#2)" d="M181 3.048c0-.808-.321-1.584-.893-2.155C179.536.321 178.76 0 177.952 0H70v20h107.952c.808 0 1.584-.321 2.155-.893.572-.571.893-1.347.893-2.155V3.048z"/><path fill="none" stroke="#f5a300" stroke-width="1.6" d="M18.783 10.473c1.421-1.42 1.785-3.599.903-5.405l-3.141 3.135c-.232.232-.614.232-.845 0l-1.338-1.335c-.113-.112-.176-.264-.176-.423 0-.158.063-.31.176-.423l3.14-3.134c-1.809-.874-3.987-.508-5.41.909-1.31 1.31-1.733 3.273-1.078 5.005l-5.552 5.54c-.355.355-.555.837-.555 1.338 0 .502.2.984.555 1.338l.002.002c.751.749 1.966.75 2.717.001l5.513-5.495c1.751.691 3.755.276 5.089-1.053z"/><text x="23.775" y="14.564" fill="#010101" fill-opacity=".3" font-family="'Verdana',sans-serif" font-size="10.833">zigtools</text><text x="74.548" y="14.544" fill="#010101" fill-opacity=".3" font-family="'Verdana',sans-serif" font-size="10.833">for all of ziguanity</text><text x="23.775" y="13.303" fill="#fff" font-family="'Verdana',sans-serif" font-size="10.833">zigtools</text><text x="74.548" y="13.284" fill="#fff" font-family="'Verdana',sans-serif" font-size="10.833">for all of ziguanity</text><defs><linearGradient id="1" x1="0" x2="1" y1="0" y2="0" gradientTransform="matrix(0 20 -20 0 37 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#444d56"/><stop offset="1" stop-color="#24292e"/></linearGradient><linearGradient id="2" x1="0" x2="1" y1="0" y2="0" gradientTransform="matrix(0 20 -20 0 104 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e3981e"/><stop offset="1" stop-color="#c77112"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

1
.github/assets/zls.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="280" height="143" viewBox="0 0 74 38"><text font-family="Inter,sans-serif" font-size="12.7" font-weight="700"><tspan x="2" y="12" fill="#f7a41d">Zig</tspan><tspan x="2" y="23">Language</tspan><tspan x="2" y="35">Server</tspan></text></svg>

After

Width:  |  Height:  |  Size: 287 B

View File

@ -1,12 +1,10 @@
![Zig Language Server](https://raw.githubusercontent.com/zigtools/zls/master/.assets/zls.svg) # Zig Language Server
![CI](https://github.com/zigtools/zls/workflows/CI/badge.svg)
![Zig Tools](https://img.shields.io/static/v1?label=zigtools&message=for%20all%20of%20ziguanity&color=F7A41D&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAEDklEQVR4nOzYbUwbZRwA8Oe53vXuSltaa2lxc+KKBGcyBhLDgH3SiSMZ++TQRT8uJH4x8S0myL6YmUjUbIkfZvZtX3TJlAwjiYImxuBwa1hEtxAcQ8GFQrtBWXvXu17vTH1ux1lv99IeLcn6//Rw9/D0l+ft/28xsC2jyrISVZaV2KYsfCsGxSDYs5OIhPCAB0tlpFt3hF//yqYyUsVYrQ3Eaz2ew0/Tta7/rENOlCZnuTMTqZHLrJlxoF2ggAf7+FVff2eNfrf+U/HRaMZwNHtmqzGMf/NucNfDxqNFQqY+0QZWYxifGKoL1TrQnzlRGrvKXphio/M8ANLEUKjeL7+aW86e+5EpB4vEwRevBxTTtSX++Gd3rv6ZBQCEfdi3g3VqU8/J1dspsRysd454n3rUidq//MH1Dcc3WEkxNdUTalNsXTYFPNgr3TULcWE0qn0CStryXhoufPqIi8wfusWE0DEYW0sbm9Rvj52Oj1zROAElXacvd7mQCQAwdH4dmdwUNGkCAAwc9GiOXBKrp4VGjcWEcGFKXo6B59wmTQCA7mbSTWmsWEmstsflXfXdTEa8d4e375YfMpx46AM9EwDAgcGWXYSdLAyCkE8+Zdf/5pXnqxs51HCR2Pv9PgxqmJbXckr/HQGHnSx1cNnN9tnvU5msPHXHumvODjy0w194AvqGV5X+bkrDUDxLlPI3J2rXujb3x+9LwoufxNWymY/qC3Ybw22m7cTdnJ0sAMD8ioAaHU+Q6ucTv3FqmXJalRPQHnEqnW/GBJtZk7Mcajy/l/bSUEdWcCqP7pczejItXr+lwSr+lg/7sK5meZIoJ2x5jPhpli+QHTixcvxZd73fcfkGd2Y8hUqu1gbihX0U6vP1NCNqlWFF3vL/v8c7BmMsb/yPXhr+cKJOyVed78VQAi2IYhZRM7eYMflr4MjbQcV0/ue0pqkYln6+o53wwJNkwT5Dl9zR/fTUyXBnk7zuiwnhzXPr9/sUa3vLZA7OZKXxGfbSHJ9kRIqAe3YSB/dS6iIxsZHrG47rFDkW9pb5ukA/ri3xL52+fUPrXlDC7GzZYmI48dTY3eGLG5weyTTLkmluOTs5y3U1k5EQ7vg3I64kc9F5fnwm8/lkGhWJhmHMsmpSvy06DE5iRUwGrEqZ9FgYBF++EayISY91pJ1qu1dnltmkx+ptlev0JCOW2aTH8rvlWvbKPFdmkx5rNSkXjZ1NZGMYL6dJL/kc2kd99VYQtRlOvDTHt0ecys9DW2rKfyO634ubK0J3M9kQzM8TgcPdIZwiYHlMeiwJgNEo+0yjE8mUmF7gD38Y31KTcQWBQdDbSvW20XVex1paHJtmL0ZZzTL3gYht+ktzlWUlqiwrUWVZiX8CAAD//7jyYLmjqPd4AAAAAElFTkSuQmCC)
Zig Language Server, or `zls`, is a language server for Zig. The Zig wiki states that "The Zig community is decentralized" and "There is no concept of 'official' or 'unofficial'", so instead of calling `zls` unofficial, and I'm going to call it a cool option, one of [many](https://github.com/search?q=zig+language+server). Zig Language Server, or `zls`, is a language server for Zig. The Zig wiki states that "The Zig community is decentralized" and "There is no concept of 'official' or 'unofficial'", so instead of calling `zls` unofficial, and I'm going to call it a cool option, one of [many](https://github.com/search?q=zig+language+server).
<!-- omit in toc --> <!-- omit in toc -->
## Table Of Contents ## Table Of Contents
- [Installation](#installation) - [Installation](#installation)
- [Build Options](#build-options) - [Build Options](#build-options)
- [Configuration Options](#configuration-options) - [Configuration Options](#configuration-options)
@ -142,6 +140,7 @@ Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-v
``` ```
#### nvim-lspconfig #### nvim-lspconfig
Requires Nvim 0.5 (HEAD)! Requires Nvim 0.5 (HEAD)!
- Install nvim-lspconfig from [here](https://github.com/neovim/nvim-lspconfig). - Install nvim-lspconfig from [here](https://github.com/neovim/nvim-lspconfig).
@ -195,6 +194,7 @@ let g:completion_enable_auto_popup = 1
``` ```
## Related Projects ## Related Projects
- [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language) - [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language)
- Supports basic language features - Supports basic language features
- Uses data provided by `src/data` to perform builtin autocompletion - Uses data provided by `src/data` to perform builtin autocompletion
@ -204,4 +204,5 @@ let g:completion_enable_auto_popup = 1
- Provides API to access known folders on Linux, Windows and Mac OS - Provides API to access known folders on Linux, Windows and Mac OS
## License ## License
MIT MIT