Implementation of AWK Language Server based on tree-sitter and tree-sitter-awk.
VSCode extension is developed as part of this project and can be downloaded from marketplace here.
Add to your config:
(with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(awk-mode . ("awk-language-server"))))
Support is built-in, so no action is needed besides turning lsp-mode
on.
npm install -g "awk-language-server@>=0.5.2"
awk-language-server
.Add following to .vimrc
:
call ale#linter#Define('awk', { \ 'name': 'awk-language-server', \ 'lsp': 'stdio', \ 'executable': 'awk-language-server', \ 'command': '%e', \ 'project_root': { _ -> expand('%p:h') } \})
Note that with such configuration project_root
will be set to directory containing opened awk file.
Edit config with :CocConfig
command and add the following:
{ "languageserver": { "awk": { "command": "awk-language-server", "args": [], "filetypes": ["awk"] } } }
It works partially unless support for multi-root workspaces is implemented by vim-lsp.
Add to your .vimrc
:
if executable('awk-language-server') au User lsp_setup call lsp#register_server({ \ 'name': 'awk-language-server', \ 'cmd': {server_info->['awk-language-server']}, \ 'allowlist': ['awk'], \ }) endif
A default config for awk-language-server
was merged into nvim-lspconfig. It works only if workspaceFolders
requests are handled and a default handler for these was only just set to be added upstream in Neovim 0.7, so the config itself is gated for use only in Neovim >= v0.7. For users below that version, please use a manual config that handles these requests by adding the following to your init.vim
(or init.lua
):
lua << EOF local configs = require('lspconfig.configs') local lspconfig = require('lspconfig') if not configs.awklsp then configs.awklsp = { default_config = { cmd = { 'awk-language-server' }, filetypes = { 'awk' }, single_file_support = true, handlers = { ['workspace/workspaceFolders'] = function() return {{ uri = 'file://' .. vim.fn.getcwd(), name = 'current_dir', }} end } }, } end lspconfig.awklsp.setup{} EOF
AWK Language Server supports AWKPATH
. If you prefer to place all your awk libs in some directory and then @include
it without dir name, then simply pass this env variable to your editor of choice.
AWKPATH=./include vim main.vim
or
export AWKPATH=./include vim main.vim
Check this cool project for inspiration.
Thanks for considering it.
Please check this guide.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4