Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.7 KB

README.md

File metadata and controls

56 lines (41 loc) · 1.7 KB

snupld

snupld is a language server for SnuPL/2 which supports the following features:

  • Error Diagnostics (aka. red squiggly lines)
  • Code Completion
  • Find References
  • Go to Definition
  • Hover Information
  • Rename Symbol
  • Semantic Highlighting
  • Document Symbol

Installation

You can get a prebuilt binary here. If you want to build snupld with your snuplc implementation, follow the steps below:

First you need to implement following methods in snuplc since snupld's scope detection is implemented in a very dumb way (or feel free to implement & contribute your own scope detection in snupld):

// return the very first token of the statement sequence (e.g. "begin")
CToken CAstScope::GetStatementSequenceBeginToken();

// return the very first token of the scope (e.g. "procedure", "function", "module")
CToken CAstScope::GetScopeBeginToken();

// return the end token of the scope (e.g. "end")
CToken CAstScope::GetEndToken();

Then build snupld along with snuplc:

SNUPLC_DIR=/path/to/snuplc make install # make sure to locate the entire snuplc directory, not the '/src' directory

You might need superuser permission to install the binary to /usr/local/bin:

sudo SNUPLC_DIR=/path/to/snuplc make install

Vim

Install vim-lsp and add the following to your vimrc:

autocmd BufNewFile,BufRead *.mod set filetype=snupl2
au User lsp_setup call lsp#register_server({
  \ 'name': 'snupld',
  \ 'cmd': {server_info->['snupld', '--stdio']},
  \ 'whitelist': ['snupl2'],
  \ })

VSCode

Install the SnuPL/2 extension from lsp/vscode-extension.