I broke up with neovim....vim is my best friend now

This commit is contained in:
LinlyBoi
2023-04-30 08:14:07 +03:00
parent 0d185449c5
commit 4a4a6b1e81
5245 changed files with 468325 additions and 25 deletions

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Yasuhiro Matsumoto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,11 @@
.PHONY: shellcheck
shellcheck:
find ./installer -name "*.sh" -type f -print0 | xargs -0 shellcheck
.PHONY: shellcheck-docker
shellcheck-docker:
find ./installer -name "*.sh" -type f -print0 | xargs -0 docker run -t --rm -v "${PWD}:/mnt" koalaman/shellcheck:stable
.PHONY: shfmt
shfmt:
find ./installer -name "*.sh" -type f -print0 | xargs -0 shfmt -w

View File

@@ -0,0 +1,420 @@
# vim-lsp-settings
[![Actions Status](https://github.com/mattn/vim-lsp-settings/workflows/reviewdog/badge.svg)](https://github.com/mattn/vim-lsp-settings/actions)
[![Actions Status](https://github.com/mattn/vim-lsp-settings/workflows/ci/badge.svg)](https://github.com/mattn/vim-lsp-settings/actions)
Auto configurations for Language Servers for [vim-lsp](https://github.com/prabirshrestha/vim-lsp).
## Introduction
Language Servers are not easy to install. Visual Studio Code provides easy ways to install and update Language Servers and Language Server Client. This plugin provides the same feature for Vim.
## Installation
Using the [vim-plug](https://github.com/junegunn/vim-plug) plugin manager:
```viml
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
```
You need to install both [vim-lsp](https://github.com/prabirshrestha/vim-lsp) and vim-lsp-settings.
## Usage
While editing a file with a supported filetype:
```
:LspInstallServer
```
To uninstall server:
```
:LspUninstallServer server-name
```
Because there is no way to update a server, please run `:LspInstallServer` again, the newer version will be installed.
### Auto-complete
If you want to use auto-completion, you can use one of the following.
#### asyncomplete.vim
```viml
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
```
#### ddc.vim
```viml
Plug 'Shougo/ddc.vim'
Plug 'shun/ddc-vim-lsp'
```
### LSP server download directory
This is where LSP servers are placed on your system after you download them with `:LspInstallServer`
#### Windows
```
%LOCALAPPDATA%\vim-lsp-settings\servers
```
#### MacOS/Linux
```
$HOME/.local/share/vim-lsp-settings/servers
```
If you define `$XDG_DATA_HOME`:
```
$XDG_DATA_HOME/vim-lsp-settings/servers
```
You can change the directory to install servers by set `g:lsp_settings_servers_dir` option in full path.
## Supported Languages
| Language | Language Server | Installer | Local Install |
| ----------------- | ----------------------------------- | :-------: | :-----------: |
| Apex/VisualForce | apex-jorje-lsp | Yes | Yes |
| Astro | astro-ls | Yes | Yes |
| Bash | bash-language-server | Yes | Yes |
| C# | omnisharp | Yes | Yes |
| C/C++ | clangd | Yes | Yes |
| COBOL | cobol-language-support | Yes | Yes |
| CSS | css-languageserver | Yes | Yes |
| CSS | tailwindcss-intellisense | Yes | Yes |
| Clojure | clojure-lsp | Yes | Yes |
| Clojure | clj-kondo-lsp | Yes | Yes |
| Cmake | cmake-language-server | Yes | Yes |
| D | dls | Yes | No |
| D | serve-d | Yes | No |
| Dart | analysis-server-dart-snapshot | Yes | Yes |
| Dockerfile | dockerfile-language-server-nodejs | Yes | Yes |
| Dot | dot-language-server | Yes | Yes |
| Elixir | elixir-ls | Yes | Yes |
| Elm | elm-language-server | Yes | Yes |
| Erlang | erlang-ls | Yes | Yes |
| F# | fsharp-language-server | Yes | Yes |
| Fortran | fortls | Yes | Yes |
| Go | gopls | Yes | Yes |
| Go | golangci-lint-langserver | Yes | Yes |
| GraphQL | graphql-language-service-cli | Yes | Yes |
| GraphQL | gql-language-server | Yes | Yes |
| Groovy | groovy-language-server | Yes | Yes |
| Haskell | haskell-ide-engine | No | No |
| Haskell | haskell-language-server | No | No |
| HTML | html-languageserver | Yes | Yes |
| HTML | angular-language-server | Yes | Yes |
| HTML | tailwindcss-intellisense | Yes | Yes |
| JSON | json-languageserver | Yes | Yes |
| JSON | rome | Yes | Yes |
| Java | eclipse-jdt-ls | Yes | Yes |
| Java | java-language-server | No | Yes |
| JavaScript | typescript-language-server | Yes | Yes |
| JavaScript | javascript-typescript-stdio | Yes | Yes |
| JavaScript | rome | Yes | Yes |
| JavaScript | flow | Yes | Yes |
| JavaScript | eslint-language-server | Yes | Yes |
| Julia | LanguageServer.jl | Yes | No |
| Kotlin | kotlin-language-server | Yes | Yes |
| Lisp | cl-lsp | Yes | No |
| Lua | emmylua-ls | Yes | Yes |
| Lua | sumneko-lua-language-server | Yes | Yes |
| Markdown (remark) | remark-language-server | Yes | Yes |
| Markdown | Marksman | Yes | Yes |
| Nim | nimls | No | No |
| Nix | rnix-lsp | Yes | Yes |
| PHP | intelephense | Yes | Yes |
| PHP | psalm-language-server | Yes | Yes |
| OCaml | ocaml-lsp | UNIX Only | Yes |
| Protobuf | bufls | Yes | Yes |
| Puppet | puppet-languageserver | Yes | Yes |
| PureScript | purescript-language-server | Yes | Yes |
| Python | pyls-all (pyls with dependencies) | Yes | Yes |
| Python | pyls (pyls without dependencies) | Yes | Yes |
| Python | pyls-ms (Microsoft Version) | Yes | Yes |
| Python | jedi-language-server | Yes | Yes |
| Python | pyright-langserver | Yes | Yes |
| Python | pylsp-all (pylsp with dependencies) | Yes | Yes |
| Python | pylsp (pylsp without dependencies) | Yes | Yes |
| Prisma | prisma-language-server | Yes | Yes |
| R | languageserver | Yes | No |
| Racket | racket-lsp | Yes | No |
| Reason | reason-language-server | Yes | Yes |
| Ruby | ruby-lsp | UNIX Only | Yes |
| Ruby | solargraph | Yes | Yes |
| Ruby | steep | Yes | Yes |
| Ruby | typeprof | Yes | Yes |
| Rust | rls | Yes | No |
| Rust | rust-analyzer | Yes | Yes |
| Sphinx | esbonio | Yes | Yes |
| SQL | sql-language-server | Yes | Yes |
| SQL | sqls | Yes | Yes |
| SQL | plpgsql-server | UNIX Only | Yes |
| Scala | Metals | Yes | Yes |
| Svelte | svelte-language-server | Yes | Yes |
| Swift | sourcekit-lsp | Yes | No |
| SystemVerilog | svls | Yes | Yes |
| TeX | texlab | Yes | Yes |
| TeX | digestif | Yes | No |
| Terraform | terraform-lsp | Yes | Yes |
| Terraform | terraform-ls | Yes | Yes |
| TOML | taplo-lsp | No | Yes |
| TTCN-3 | ntt | Yes | Yes |
| TypeScript | typescript-language-server | Yes | Yes |
| TypeScript | deno | Yes | Yes |
| TypeScript | rome | Yes | Yes |
| TypeScript | eslint-language-server | Yes | Yes |
| Vim | vim-language-server | Yes | Yes |
| Vala | vala-language-server | No | No |
| Vue | volar-server | Yes | Yes |
| Vue | vls | Yes | Yes |
| V | vlang-vls | Yes | Yes |
| XML | lemminx | Yes | Yes |
| YAML | yaml-language-server | Yes | Yes |
| ZIG | zls | Yes | Yes |
| \* | efm-langserver | Yes | Yes |
## Notes
### clangd (C/C++)
There is a Linux OS/version that does not run the locally installed `clangd` due to zlib version mismatch. If you want to use `clangd`, please install `clangd` on your system.
### rls (Rust)
If you installed `rls` already, you can use `rls` without configurations. But if you have not installed `rls` yet, you can install it by following [these instructions](https://github.com/rust-lang/rls#setup).
### deno (TypeScript)
To use deno, `deno.json(c)` should located on the project directory or traversing the filesystem upwards.
If `deno.json` does not located, `node_modules` should **not** located on the project directory or traversing the filesystem upwards.
When editing Node projects, the following warning message is shown.
`server "deno" is disabled since "node_modules" is found`
If you want to disable warning message, you may put `.vim-lsp-settings/settings.json` in your project root directory.
```json
{
"deno": {
"disabled": true
}
}
```
To use importMap, default file name is `import_map.json`.
If you don't want to use `import_map.json`, you may put `.vim-lsp-settings/settings.json` in your project root directory and set importMap whatever you want.
```
{
"deno": {
"initialization_options": {
"enable": true,
"lint": true,
"unstable": true,
"importMap": "your_own_import_map.json"
}
}
}
```
Recommend to add `let g:markdown_fenced_languages = ['ts=typescript']` to your
vimrc for hover(preview) Deno's library.
Note that `deno` language server is specified.
```vim
let g:lsp_settings_filetype_typescript = ['typescript-language-server', 'eslint-language-server', 'deno']
```
### flow (JavaScript)
To use flow, the `.flowconfig` has to be located on the top of project directory.
### graphql-language-service-cli(GraphQL)
To use graphql-language-service-cli, the [GraphQL Config](https://graphql-config.com/introduction#examples) has to be located on the top of project directory. The schema must be pointed to the schema file correctly.
```json
{
"schema": "./schema.graphql"
}
```
### gql-language-server (GraphQL)
To use gql-language-server, the `.gqlconfig` has to be located on the top of project directory. The schema must be pointed to the schema file correctly.
```json5
{
schema: {
files: 'path/to/schema.graphql'
}
}
```
Finally, you have to install `@playlyfe/gql` into your project.
```
$ npm install @playlyfe/gql --save-dev
```
### [dart analysis server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) (Dart)
If you have a separate existing installation of the dart analysis server and
want it to be used, it must either exist in your path, or you must specify its
location. See 'Configurations' below.
### [haskell ide engine](https://github.com/haskell/haskell-ide-engine) (Haskell)
If you installed `hie` with stack, you can use hie without configurations.
But if you have not installed `hie` yet, you can install it by following [these steps](https://github.com/haskell/haskell-ide-engine#installation).
### [golangci-lint-langserver](https://github.com/nametake/golangci-lint-langserver) (Go)
To use older version `golangci-lint`, please run `:LspSettingsGlobalEdit` and put bellow configuration.
```json5
"golangci-lint-langserver": {
"initialization_options": {
"command": [
"golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json"
]
}
}
```
## Extra Configurations
Most of the configurations are not required.
If you installed `clangd` already, you can use `clangd` for C/C++ without any configuration. But if you installed `clang` with the name` clangd-6.0`, you can replace executable with the following config:
```vim
let g:lsp_settings = {
\ 'clangd': {'cmd': ['clangd-6.0']},
\ 'efm-langserver': {'disabled': v:false}
\}
```
Or put `.vim-lsp-settings/settings.json` in your project root directory.
```json
{
"clangd": {
"cmd": ["clangd-6.0"]
},
"efm-langserver": {
"disabled": false
}
}
```
If you already have the dart analysis server installed but it is not in your
path, you can still configure the settings to use it. Use the vimscript below
to change the command to start the server. Note the command has two parts:
the path to your 'dart' executable, and a subcommand 'language-server.
```vimscript
let g:lsp_settings = {
\ 'analysis-server-dart-snapshot': {
\ 'cmd': [
\ '/path/to/your/dart-sdk/bin/dart',
\ 'language-server'
\ ],
\ },
\ }
```
To edit the project local `settings.json`, do `:LspSettingsLocalEdit`.
Overridable keys are:
* cmd (List ex: `['clangd-6.0', '-enable-snippets']`)
* initialization_options (Dictionary)
* allowlist (List)
* blocklist (List)
* config (Dictionary)
* workspace_config (Dictionary)
* disabled (Boolean)
* root_uri (String)
* root_uri_patterns (List)
* semantic_highlight (Dictionary)
If you have some Language Servers and want to use specified the server:
```vim
let g:lsp_settings_filetype_perl = 'slp'
let g:lsp_settings_filetype_html = ['html-languageserver', 'angular-language-server']
let g:lsp_settings_filetype_typescript = ['typescript-language-server', 'eslint-language-server']
```
When the servers are specified in a list, these will all be started.
If you want to configure Language Server to use `flake8` rather than `pycodestyle`,
the following can be added to your `~/.vimrc` file.
Note that `pylsp-all` was the automatically registered server name. Check with `:LspStatus`.
```vim
let g:lsp_settings = {
\ 'pylsp-all': {
\ 'workspace_config': {
\ 'pylsp': {
\ 'configurationSources': ['flake8']
\ }
\ }
\ },
\}
```
If you want to disable a Language Server:
```vim
let g:lsp_settings = {
\ 'perl-languageserver': {
\ 'disabled': 1,
\ }
\}
```
When resolving the root directory for a language server, this plugin will look
for directories containing special root markers defined in `g:lsp_settings_root_markers`.
By default, this is set to:
```vim
let g:lsp_settings_root_markers = [
\ '.git',
\ '.git/',
\ '.svn',
\ '.hg',
\ '.bzr'
\ ]
```
If you need to specify alternative root markers:
```vim
let g:lsp_settings_root_markers = ['.projections.json', '.git', '.git/']
```
This would look for a custom `.projections.json`, a git submodule `.git` or a git root
`.git/` starting from the current directory upwards.
## License
MIT
## Author
Yasuhiro Matsumoto (a.k.a. mattn)

View File

@@ -0,0 +1,635 @@
let s:root_dir = expand('<sfile>:h:h')
let s:settings_dir = s:root_dir . '/settings'
let s:checkers_dir = s:root_dir . '/checkers'
let s:installer_dir = s:root_dir . '/installer'
if has('win32')
let s:data_dir = expand('$LOCALAPPDATA/vim-lsp-settings')
elseif $XDG_DATA_HOME !=# ''
let s:data_dir = expand('$XDG_DATA_HOME/vim-lsp-settings')
else
let s:data_dir = expand('~/.local/share/vim-lsp-settings')
endif
let s:servers_dir = s:data_dir . '/servers'
let s:settings = json_decode(join(readfile(s:root_dir . '/settings.json'), "\n"))
call remove(s:settings, '$schema')
let s:ftmap = {}
function! lsp_settings#installer_dir() abort
return s:installer_dir
endfunction
function! lsp_settings#servers_dir() abort
let l:path = resolve(fnamemodify(get(g:, 'lsp_settings_servers_dir', s:servers_dir), ':p'))
if has('win32')
let l:path = substitute(l:path, '/', '\', 'g')
endif
return substitute(l:path, '[\/]$', '', '')
endfunction
function! lsp_settings#global_settings_dir() abort
let l:path = fnamemodify(get(g:, 'lsp_settings_global_settings_dir', s:data_dir), ':p')
if has('win32')
let l:path = substitute(l:path, '/', '\', 'g')
endif
return substitute(l:path, '[\/]$', '', '')
endfunction
function! lsp_settings#installed_servers() abort
let l:servers = []
for l:ft in sort(keys(s:settings))
for l:conf in s:settings[l:ft]
let l:path = lsp_settings#servers_dir() . '/' . l:conf.command . '/' . l:conf.command
if !executable(l:path)
continue
endif
let l:path = lsp_settings#servers_dir() . '/' . l:conf.command . '/.vim-lsp-settings-version'
let l:version = ''
if filereadable(l:path)
let l:version = trim(join(readfile(l:path), "\n"))
endif
call add(l:servers, {'name': l:conf.command, 'version': l:version})
endfor
endfor
return l:servers
endfunction
function! lsp_settings#executable(cmd) abort
if executable(a:cmd)
return 1
endif
let l:paths = get(g:, 'lsp_settings_extra_paths', '')
if type(l:paths) == type([])
let l:paths = join(l:paths, ',')
endif
let l:paths .= ',' . lsp_settings#servers_dir() . '/' . a:cmd
if !has('win32')
let l:found = globpath(l:paths, a:cmd, 1)
return !empty(l:found)
endif
for l:ext in ['.exe', '.cmd', '.bat']
if !empty(globpath(l:paths, a:cmd . l:ext, 1))
return 1
endif
endfor
return 0
endfunction
function! s:vim_lsp_installer(ft, ...) abort
let l:ft = tolower(get(split(a:ft, '\.'), 0, ''))
let l:ft = empty(l:ft) ? '_' : l:ft
if !has_key(s:settings, l:ft)
return []
endif
let l:servers = s:settings[l:ft]
if empty(l:servers)
return []
endif
if l:ft !=# '_'
let l:servers += s:settings['_']
endif
let l:default = get(g:, 'lsp_settings_filetype_' . a:ft, '')
let l:name = get(a:000, 0, '')
for l:conf in l:servers
if !empty(l:name) && l:conf.command != l:name
continue
endif
if lsp_settings#get(l:conf.command, 'disabled', get(l:conf, 'disabled', 0))
if !empty(l:name) && l:conf.command == l:name
call lsp_settings#utils#warning(l:name . ' requested but is disabled by global or local settings')
endif
continue
endif
if type(l:default) ==# v:t_list
if len(l:default) ># 0 && index(l:default, l:conf.command) == -1
if !empty(l:name) && l:conf.command == l:name
call lsp_settings#utils#warning(l:name . ' requested but is disabled by g:lsp_settings_filetype_' . a:ft)
endif
continue
endif
elseif type(l:default) ==# v:t_string
if !empty(l:default) && l:default != l:conf.command
if !empty(l:name) && l:conf.command == l:name
call lsp_settings#utils#warning(l:name . ' requested but is disabled by g:lsp_settings_filetype_' . a:ft)
endif
continue
endif
else
if !empty(l:name) && l:conf.command == l:name
call lsp_settings#utils#warning(l:name . ' requested but is disabled by g:lsp_settings_filetype_' . a:ft)
endif
continue
endif
let l:command = printf('%s/install-%s', s:installer_dir, l:conf.command)
if has('win32')
let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
else
let l:command = l:command . '.sh'
endif
let l:missing = 0
for l:require in l:conf.requires
if !lsp_settings#executable(l:require)
call lsp_settings#utils#warning(l:conf.command . ' requires ' . l:require)
let l:missing = 1
break
endif
endfor
if l:missing !=# 0
continue
endif
if lsp_settings#executable(l:command)
return [l:conf.command, l:command]
endif
endfor
return [v:false] " placeholder, so that empty() returns false, but len() < 2 returns true
endfunction
function! lsp_settings#server_config(name) abort
for l:ft in sort(keys(s:settings))
for l:conf in s:settings[l:ft]
if l:conf.command ==# a:name && has_key(l:conf, 'config')
return l:conf['config']
endif
endfor
endfor
return {}
endfunction
function! lsp_settings#merge(name, key, default) abort
let l:config = lsp_settings#get(a:name, a:key, {})
if type(a:default) ==# v:t_func
return extend(l:config, a:default(a:name, a:key))
endif
return lsp_settings#utils#extend(l:config, a:default)
endfunction
function! lsp_settings#set(name, key, value) abort
if !has_key(g:, 'lsp_settings')
let g:lsp_settings = {}
endif
if !has_key(g:lsp_settings, a:name)
let g:lsp_settings[a:name] = {}
endif
if !has_key(g:lsp_settings[a:name], a:key)
let g:lsp_settings[a:name][a:key] = {}
endif
let g:lsp_settings[a:name][a:key] = a:value
endfunction
function! lsp_settings#get(name, key, default) abort
let l:config = get(g:, 'lsp_settings', {})
if !has_key(l:config, a:name)
if !has_key(l:config, '*')
if type(a:default) ==# v:t_func
return a:default(a:name, a:key)
endif
return a:default
endif
let l:config = l:config['*']
else
let l:config = l:config[a:name]
endif
if !has_key(l:config, a:key)
if type(a:default) ==# v:t_func
return a:default(a:name, a:key)
endif
return a:default
endif
if type(l:config[a:key]) == v:t_func
return l:config[a:key](a:name, a:key)
endif
return l:config[a:key]
endfunction
function! lsp_settings#exec_path(cmd) abort
let l:paths = []
if has('win32')
for l:path in split($PATH, ';')
if l:path[len(l:path) - 1:] == "\\"
call add(l:paths, l:path[:len(l:path)-2])
elseif !empty(l:path)
call add(l:paths, l:path)
endif
endfor
else
let l:paths = split($PATH, ':')
endif
let l:paths = join(l:paths, ',')
let l:path = globpath(l:paths, a:cmd, 1)
if !has('win32')
if !empty(l:path)
return lsp_settings#utils#first_one(l:path)
endif
else
for l:ext in ['.exe', '.cmd', '.bat']
let l:path = globpath(l:paths, a:cmd . l:ext, 1)
if !empty(l:path)
return lsp_settings#utils#first_one(l:path)
endif
endfor
endif
let l:paths = get(g:, 'lsp_settings_extra_paths', '')
if type(l:paths) == type([])
let l:paths = join(l:paths, ',') . ','
endif
if !has('win32')
let l:paths .= lsp_settings#servers_dir() . '/' . a:cmd
return lsp_settings#utils#first_one(globpath(l:paths, a:cmd, 1))
endif
let l:paths .= lsp_settings#servers_dir() . '\' . a:cmd
for l:ext in ['.exe', '.cmd', '.bat']
let l:path = globpath(l:paths, a:cmd . l:ext, 1)
if !empty(l:path)
return lsp_settings#utils#first_one(l:path)
endif
endfor
return ''
endfunction
function! lsp_settings#root_path(patterns) abort
let l:patterns = extend(copy(a:patterns), g:lsp_settings_root_markers)
return lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), l:patterns)
endfunction
function! lsp_settings#root_uri(name) abort
let l:patterns = lsp_settings#get(a:name, 'root_uri_patterns', [])
if empty(l:patterns)
for l:ft in sort(keys(s:settings))
for l:conf in s:settings[l:ft]
if l:conf.command ==# a:name && has_key(l:conf, 'root_uri_patterns')
let l:patterns = l:conf['root_uri_patterns']
break
endif
endfor
endfor
endif
let l:dir = lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), extend(copy(l:patterns), g:lsp_settings_root_markers))
if empty(l:dir)
return lsp#utils#get_default_root_uri()
endif
return lsp#utils#path_to_uri(l:dir)
endfunction
function! lsp_settings#autocd(server_info) abort
if !has_key(a:server_info, 'root_uri')
return
endif
if type(a:server_info['root_uri']) ==# v:t_func
let l:root_uri = a:server_info['root_uri'](a:server_info)
else
let l:root_uri = a:server_info['root_uri']
endif
let l:path = lsp#utils#uri_to_path(l:root_uri)
if isdirectory(l:path)
exe 'cd' l:path
endif
endfunction
function! lsp_settings#settings() abort
return s:settings
endfunction
function! lsp_settings#complete_uninstall(arglead, cmdline, cursorpos) abort
let l:installers = []
for l:ft in sort(keys(s:settings))
for l:conf in s:settings[l:ft]
if !isdirectory(lsp_settings#servers_dir() . '/' . l:conf.command)
continue
endif
call add(l:installers, l:conf.command)
endfor
endfor
return filter(uniq(sort(l:installers)), 'stridx(v:val, a:arglead) == 0')
endfunction
function! lsp_settings#complete_install(arglead, cmdline, cursorpos) abort
let l:installers = []
for l:ft in split(&filetype . '.', '\.', 1)
let l:ft = tolower(empty(l:ft) ? '_' : l:ft)
if !has_key(s:settings, l:ft)
continue
endif
for l:conf in s:settings[l:ft]
let l:missing = 0
for l:require in l:conf.requires
if !executable(l:require)
let l:missing = 1
break
endif
endfor
if l:missing !=# 0
continue
endif
let l:command = printf('%s/install-%s', s:installer_dir, l:conf.command)
if has('win32')
let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
else
let l:command = l:command . '.sh'
endif
if executable(l:command)
call add(l:installers, l:conf.command)
endif
endfor
endfor
return filter(uniq(sort(l:installers)), 'stridx(v:val, a:arglead) == 0')
endfunction
function! s:vim_lsp_uninstall_server(command) abort
if !lsp_settings#utils#valid_name(a:command)
call lsp_settings#utils#error('Invalid server name')
return
endif
call lsp_settings#utils#msg('Uninstalling ' . a:command)
let l:server_install_dir = lsp_settings#servers_dir() . '/' . a:command
if has('win32')
let l:server_install_dir = substitute(l:server_install_dir, '/', '\', 'g')
endif
if !isdirectory(l:server_install_dir)
call lsp_settings#utils#error('Server not found')
return
endif
call delete(l:server_install_dir, 'rf')
call lsp_settings#utils#msg('Uninstalled ' . a:command)
endfunction
" neovim passes third argument as 'exit' while vim passes only 2 arguments
function! s:vim_lsp_install_server_post(command, job, code, ...) abort
if a:code != 0
return
endif
if lsp_settings#executable(a:command)
let l:script = printf('%s/%s.vim', s:settings_dir, a:command)
if filereadable(l:script)
if has('patch-8.1.1113')
command! -nargs=1 LspRegisterServer autocmd User lsp_setup ++once call lsp_settings#register_server(<args>)
else
command! -nargs=1 LspRegisterServer autocmd User lsp_setup call lsp_settings#register_server(<args>)
endif
exe 'source' l:script
delcommand LspRegisterServer
doautocmd <nomodeline> User lsp_setup
endif
endif
call lsp_settings#utils#msg('Installed ' . a:command)
endfunction
function! lsp_settings#install_server(ft, command) abort
call s:vim_lsp_install_server(a:ft, a:command, '!')
endfunction
function! s:vim_lsp_install_server(ft, command, bang) abort
if !empty(a:command) && !lsp_settings#utils#valid_name(a:command)
call lsp_settings#utils#error('Invalid server name')
return
endif
call lsp#stop_server(a:command)
let l:entry = s:vim_lsp_installer(a:ft, a:command)
if empty(l:entry)
call lsp_settings#utils#error('Server not found')
return
endif
if len(l:entry) < 2
call lsp_settings#utils#error('Server could not be installed. See :messages for details.')
return
endif
if empty(a:bang) && confirm(printf('Install %s ?', l:entry[0]), "&Yes\n&Cancel") !=# 1
return
endif
let l:server_install_dir = lsp_settings#servers_dir() . '/' . l:entry[0]
if has('win32')
let l:server_install_dir = substitute(l:server_install_dir, '/', '\', 'g')
endif
if isdirectory(l:server_install_dir)
call lsp_settings#utils#msg('Uninstalling ' . l:entry[0])
call delete(l:server_install_dir, 'rf')
endif
call mkdir(l:server_install_dir, 'p')
call lsp_settings#utils#msg('Installing ' . l:entry[0])
if has('nvim')
split new
call termopen([l:entry[1]], {'cwd': l:server_install_dir, 'on_exit': function('s:vim_lsp_install_server_post', [l:entry[0]])}) | startinsert
else
let l:bufnr = term_start([l:entry[1]], {'cwd': l:server_install_dir})
let l:job = term_getjob(l:bufnr)
if l:job != v:null
call job_setoptions(l:job, {'exit_cb': function('s:vim_lsp_install_server_post', [l:entry[0]])})
endif
endif
endfunction
function! s:vim_lsp_settings_suggest(ft) abort
let l:entry = s:vim_lsp_installer(a:ft)
if empty(l:entry)
return
endif
if len(l:entry) < 2
return
endif
if lsp_settings#executable(l:entry[0])
return
endif
redraw!
echohl Directory
unsilent echomsg 'Please do :LspInstallServer to enable Language Server ' . l:entry[0]
echohl None
endfunction
function! s:vim_lsp_suggest_plugin() abort
if &ft != ''
return
endif
let l:ext = expand('%:e')
for l:ft in keys(s:settings)
for l:server in s:settings[l:ft]
if !has_key(l:server, 'vim_plugin')
continue
endif
if index(l:server['vim_plugin']['extensions'], l:ext) == -1
continue
endif
redraw
echohl Directory
echomsg printf('Please install vim-plugin "%s" to enable Language Server', l:server['vim_plugin']['name'])
echohl None
return
endfor
endfor
endfunction
function! lsp_settings#register_server(...) abort
let l:name = a:000[0]['name']
let l:env = lsp_settings#get(l:name, 'env', {})
if !empty(l:env)
let a:000[0]['env'] = l:env
endif
return call('lsp#register_server', a:000)
endfunction
function! s:vim_lsp_load_or_suggest(ft) abort
if (a:ft !=# '_' && &filetype !=# a:ft) || !has_key(s:settings, a:ft)
return
endif
if filereadable(lsp_settings#global_settings_dir() . '/settings.json')
let l:settings = json_decode(join(readfile(lsp_settings#global_settings_dir() . '/settings.json'), "\n"))
if has_key(g:, 'lsp_settings')
call extend(g:lsp_settings, l:settings)
else
let g:lsp_settings = l:settings
endif
endif
call lsp_settings#profile#load_local()
if get(g:, 'lsp_loaded', 0)
for l:server in s:settings[a:ft]
let l:config = lsp_settings#server_config(l:server.command)
let l:refresh_pattern = get(l:config, 'refresh_pattern', '')
if !empty(l:refresh_pattern)
let b:asyncomplete_refresh_pattern = l:refresh_pattern
endif
endfor
endif
if get(s:ftmap, a:ft, 0)
return
endif
let l:group_name = lsp_settings#utils#group_name(a:ft)
exe 'augroup' l:group_name
autocmd!
augroup END
exe 'augroup!' l:group_name
if has('patch-8.1.1113')
command! -nargs=1 LspRegisterServer autocmd User lsp_setup ++once call lsp_settings#register_server(<args>)
else
command! -nargs=1 LspRegisterServer autocmd User lsp_setup call lsp_settings#register_server(<args>)
endif
let l:default = get(g:, 'lsp_settings_filetype_' . a:ft, '')
let l:found = 0
let l:disabled = 0
for l:server in s:settings[a:ft]
if lsp_settings#get(l:server.command, 'disabled', get(l:server, 'disabled', 0))
let l:disabled += 1
continue
endif
if type(l:default) ==# v:t_list
if len(l:default) ># 0 && index(l:default, l:server.command) == -1
continue
endif
elseif type(l:default) ==# v:t_string
if !empty(l:default) && l:default != l:server.command
continue
endif
else
continue
endif
let l:command = lsp_settings#get(l:server.command, 'cmd', [])
if empty(l:command) && !lsp_settings#executable(l:server.command)
let l:script = printf('%s/%s.vim', s:checkers_dir, l:server.command)
if !filereadable(l:script) || has_key(l:server, 'fallback')
continue
endif
let l:server['fallback'] = ''
try
exe 'source' l:script
let l:command = LspCheckCommand()
let l:server['fallback'] = l:command
catch
finally
if exists('*LspCheckCommand')
delfunction LspCheckCommand
endif
if empty(l:server['fallback'])
continue
endif
endtry
endif
let l:script = printf('%s/%s.vim', s:settings_dir, l:server.command)
if filereadable(l:script)
exe 'source' l:script
let l:found += 1
let s:ftmap[a:ft] = 1
" If default server is specified as list, continue to look next.
if type(l:default) !=# v:t_list
break
endif
endif
endfor
delcommand LspRegisterServer
if l:disabled == 0 && l:found ==# 0
if a:ft !=# '_' && get(g:, 'lsp_settings_enable_suggestions', 1) == 1
call s:vim_lsp_settings_suggest(a:ft)
endif
else
if exists('#User#lsp_setup') !=# 0
doautocmd <nomodeline> User lsp_setup
endif
endif
endfunction
function! lsp_settings#clear() abort
let s:ftmap = {}
endfunction
function! lsp_settings#init() abort
for [l:name, l:server] in items(get(g:, 'lsp_settings', {}))
if !has_key(l:server, 'allowlist')
continue
endif
for l:ft in l:server['allowlist']
if !has_key(s:settings, l:ft)
let s:settings[l:ft] = []
endif
let l:found = 0
for [l:ft2, l:configs] in items(s:settings)
if l:found || l:ft ==# l:ft2
continue
endif
for l:config in l:configs
if l:config.command !=# l:name
continue
endif
call add(s:settings[l:ft], l:config)
let l:found = 1
break
endfor
endfor
endfor
endfor
for l:ft in keys(s:settings)
if has_key(g:, 'lsp_settings_allowlist') && index(g:lsp_settings_allowlist, l:ft) == -1 || empty(s:settings[l:ft])
continue
endif
exe 'augroup' lsp_settings#utils#group_name(l:ft)
autocmd!
exe 'autocmd FileType' l:ft 'call' printf("s:vim_lsp_load_or_suggest('%s')", l:ft)
augroup END
endfor
augroup vim_lsp_suggest
autocmd!
autocmd BufNewFile,BufRead * call s:vim_lsp_suggest_plugin()
augroup END
command! -nargs=? -complete=customlist,lsp_settings#complete_uninstall LspUninstallServer call s:vim_lsp_uninstall_server(<q-args>)
command! -bang -nargs=? -complete=customlist,lsp_settings#complete_install LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>, '<bang>')
call s:vim_lsp_load_or_suggest('_')
endfunction

View File

@@ -0,0 +1,120 @@
function! s:filter_deny_keys(settings) abort
let l:deny_keys = get(g:, 'lsp_settings_deny_local_keys', ['cmd'])
if empty(l:deny_keys)
return
endif
for l:setting in values(a:settings)
if v:t_dict !=# type(l:setting)
continue
endif
for l:v in values(l:setting)
if v:t_dict !=# type(l:v)
continue
endif
for l:deny in l:deny_keys
if has_key(l:v, l:deny)
call remove(l:v, l:deny)
endif
endfor
endfor
endfor
endfunction
function! lsp_settings#profile#load_local() abort
try
let l:dir = expand('%:p:h')
let l:root = finddir('.vim-lsp-settings', l:dir . ';')
if empty(l:root)
return
endif
if !filereadable(l:root . '/settings.json')
return
endif
let l:settings = json_decode(join(readfile(l:root . '/settings.json'), "\n"))
call s:filter_deny_keys(l:settings)
if has_key(g:, 'lsp_settings')
for [l:k, l:v] in items(l:settings)
if has_key(g:lsp_settings, l:k)
let g:lsp_settings[l:k] = lsp_settings#utils#extend(g:lsp_settings[l:k], l:v)
else
let g:lsp_settings[l:k] = l:v
endif
endfor
else
let g:lsp_settings = l:settings
endif
catch
endtry
endfunction
function! lsp_settings#profile#edit_global() abort
let l:root = lsp_settings#global_settings_dir()
if !isdirectory(l:root)
call mkdir(l:root)
endif
exe 'new' l:root . '/settings.json'
if !filereadable(l:root . '/settings.json')
call setline(1, ['{', "\t", '}'])
call cursor([2, 2])
setlocal nomodified
endif
endfunction
function! lsp_settings#profile#edit_local(...) abort
let l:root = ''
if a:0 >= 1
let l:root = a:1
endif
if l:root ==# ''
let l:root = lsp_settings#root_path(['.vim-lsp-settings'])
endif
if empty(l:root)
let l:root = getcwd()
endif
if !isdirectory(l:root)
return
endif
let l:root .= '/.vim-lsp-settings'
if !isdirectory(l:root)
call mkdir(l:root)
endif
exe 'new' l:root . '/settings.json'
if !filereadable(l:root . '/settings.json')
call setline(1, ['{', "\t", '}'])
call cursor([2, 2])
setlocal nomodified
endif
endfunction
let s:color_map = {
\ 'exited': 'Error',
\ 'starting': 'MoreMsg',
\ 'failed': 'WarningMsg',
\ 'running': 'Keyword',
\ 'not running': 'NonText'
\}
function! lsp_settings#profile#status() abort
let l:settings = lsp_settings#settings()
let l:active_servers = lsp#get_allowed_servers()
let l:servers = []
for l:ft in keys(l:settings)
for l:v in l:settings[l:ft]
if index(l:servers, l:v.command) ==# -1
call add(l:servers, l:v.command)
endif
endfor
endfor
for l:server in uniq(sort(l:servers))
if index(l:active_servers, l:server) != -1
let l:status = lsp#get_server_status(l:server)
echon l:server . ': '
exec 'echohl' s:color_map[l:status]
echon l:status
echohl None
endif
echo ''
endfor
endfunction

View File

@@ -0,0 +1,107 @@
function! s:install_or_update() abort
let l:line = getline('.')
let l:token = matchlist(getline('.'), '\[.\] \(\S\+\)\s\+(\([^)]\+\))')
let l:command = l:token[1]
let l:languages = split(l:token[2], ',\s*')
if empty(l:command)
return
endif
if confirm('Install ' . l:command . ' ?', "&OK\n&Cancel") ==# 2
return
endif
bw!
call lsp_settings#install_server(l:languages[0], l:command)
endfunction
function! s:open() abort
let l:command = substitute(getline('.'), '\[.\] \(\S\+\).*', '\1', '')
if empty(l:command)
return
endif
let l:settings = lsp_settings#settings()
for l:ft in sort(keys(l:settings))
for l:conf in l:settings[l:ft]
if l:conf.command ==# l:command
let l:cmd = ''
if !lsp_settings#utils#open_url(l:conf.url)
return
endif
break
endif
endfor
endfor
endfunction
function! s:help() abort
let l:command = substitute(getline('.'), '\[.\] \(\S\+\).*', '\1', '')
if empty(l:command)
return
endif
let l:settings = lsp_settings#settings()
for l:ft in sort(keys(l:settings))
for l:conf in l:settings[l:ft]
if l:conf.command ==# l:command
echomsg l:conf.url
echomsg l:conf.description
return
endif
endfor
endfor
endfunction
function! s:uninstall() abort
let l:command = substitute(getline('.'), '\[.\] \(\S\+\).*', '\1', '')
if empty(l:command)
return
endif
if confirm('Uninstall ' . l:command . ' ?', "&OK\n&Cancel") ==# 2
return
endif
bw!
exe 'LspUninstallServer' l:command
endfunction
function! lsp_settings#ui#open() abort
silent new __LSP_SETTINGS__
only!
setlocal buftype=nofile bufhidden=wipe noswapfile cursorline
silent! %d _
let l:names = []
let l:types = {}
let l:installer_dir = lsp_settings#installer_dir()
let l:settings = lsp_settings#settings()
for l:ft in sort(keys(l:settings))
for l:conf in l:settings[l:ft]
let l:missing = 0
for l:require in l:conf.requires
if !executable(l:require)
let l:missing = 1
break
endif
endfor
if l:missing ># 0
continue
endif
call add(l:names, l:conf.command)
if !has_key(l:types, l:conf.command)
let l:types[l:conf.command] = [l:ft]
else
call add(l:types[l:conf.command], l:ft)
endif
endfor
endfor
let l:names = uniq(sort(l:names))
call map(l:names, {_, v -> printf('%s %s (%s)', lsp_settings#executable(v) ? '[*]' : '[ ]', v, join(l:types[v], ', '))})
cal setline(1, l:names)
setlocal nomodifiable nomodified
nnoremap <buffer> i :call <SID>install_or_update()<cr>
nnoremap <buffer> x :call <SID>uninstall()<cr>
nnoremap <buffer> b :call <SID>open()<cr>
nnoremap <buffer> ? :call <SID>help()<cr>
nnoremap <buffer> q :bw<cr>
redraw
echomsg 'Type i to install, or x to uninstall, b to open browser, ? to show description'
endfunction

View File

@@ -0,0 +1,187 @@
function! lsp_settings#utils#msg(msg, ...) abort
redraw
echohl Comment
echo a:msg
echohl None
return a:0 > 0 ? a:000[0] : v:null
endfunction
function! lsp_settings#utils#warning(msg, ...) abort
redraw
echohl WarningMsg
echomsg a:msg
echohl None
return a:0 > 0 ? a:000[0] : v:null
endfunction
function! lsp_settings#utils#error(msg, ...) abort
redraw
echohl Error
echomsg a:msg
echohl None
return a:0 > 0 ? a:000[0] : v:null
endfunction
function! lsp_settings#utils#valid_name(command) abort
return a:command =~# '^[a-zA-Z0-9_-]\+$'
endfunction
function! lsp_settings#utils#group_name(ft) abort
return printf('vim_lsp_suggest_%s', a:ft)
endfunction
function! lsp_settings#utils#first_one(lines) abort
if empty(a:lines)
return ''
endif
let l:path = fnamemodify(split(a:lines, "\n")[0], ':p')
if has('win32')
let l:path = substitute(l:path, '/', '\', 'g')
endif
return l:path
endfunction
function! lsp_settings#utils#dotmerge(d) abort
let l:ret = {}
let l:keys = keys(a:d)
for l:k in sort(keys(a:d))
let l:new = {}
let l:cur = l:new
let l:arr = split(l:k, '\.')
for l:i in range(len(l:arr))
let l:kk = l:arr[l:i]
if type(l:cur) == v:t_dict && !has_key(l:cur, l:kk)
if l:i == len(l:arr) - 1
let l:cur[l:kk] = a:d[l:k]
break
else
let l:cur[l:kk] = {}
endif
endif
let l:cur = l:cur[l:kk]
endfor
let l:ret = extend(l:ret, l:new)
endfor
return l:ret
endfunction
let s:catalog_path = expand('<sfile>:h:h:h') . '/data/catalog.json'
function! lsp_settings#utils#load_schemas(name) abort
let l:schemas = json_decode(join(readfile(s:catalog_path), "\n"))['schemas']
return extend(l:schemas, lsp_settings#get(a:name, 'schemas', []))
endfunction
function! lsp_settings#utils#load_schemas_map(name) abort
let l:schemas = json_decode(join(readfile(s:catalog_path), "\n"))['schemas']
let l:result = {}
for l:v in extend(l:schemas, lsp_settings#get(a:name, 'schemas', []))
if has_key(l:v, 'fileMatch')
let l:result[l:v['url']] = l:v['fileMatch']
endif
endfor
return l:result
endfunction
function! lsp_settings#utils#term_start(cmd, options) abort
let l:options = {}
if has_key(a:options, 'cwd')
let l:options['cwd'] = a:options['cwd']
endif
if has('nvim')
split new
call termopen(a:cmd, l:options)
else
call term_start(a:cmd, l:options)
endif
endfunction
function! s:add(lhs, rhs) abort
for l:V in a:rhs
if index(a:lhs, l:V) == -1
call add(a:lhs, l:V)
endif
endfor
return a:rhs
endfunction
function! s:extend(lhs, rhs) abort
let [l:lhs, l:rhs] = [a:lhs, a:rhs]
if type(l:lhs) ==# 3
if type(l:rhs) ==# 3
" [1,2,3]+[4,5,6]=[1,2,3,4,5,6]
call s:add(l:lhs, l:rhs)
elseif type(l:rhs) ==# 4
" [1,2,3]+{'a':1,'b':2}= [1,2,3,{'a':1},{'b':2}]
call s:add(l:lhs, map(keys(l:rhs), '{v:val : l:rhs[v:val]}'))
endif
elseif type(l:lhs) ==# 4
if type(l:rhs) ==# 3
" {'a':1,'b':2}+[{'c':3},{'d':4},5]= {'a':1,'b':2,'c':3,'d':4}
for l:V in l:rhs
if type(l:V) != 4
continue
endif
for l:k in keys(l:V)
let l:lhs[l:k] = l:V[l:k]
endfor
endfor
elseif type(l:rhs) ==# 4
" {'a':1,'b':2}+{'c':3,'d':4}= {'a':1,'b':2,'c':3,'d':4}
for l:key in keys(l:rhs)
if type(l:rhs[l:key]) ==# 3
" {'a':1,'b':2}+{'c':[1]}={'a':1,'b':2,'c':[1]}
if !has_key(l:lhs, l:key)
let l:lhs[l:key] = []
endif
if type(l:lhs[l:key]) == 3
" {'a':[1],'b':2}+{'a':[2]}={'a':[1,2],'b':2}
call s:add(l:lhs[l:key], l:rhs[l:key])
elseif type(l:lhs[l:key]) == 4
" {'a':{'aa':1},'b':2}+{'a':[2]}={'a':[2],'b':2}
for l:k in keys(l:rhs[l:key])
let l:lhs[l:key][l:k] = l:rhs[l:key][l:k]
endfor
endif
elseif type(l:rhs[l:key]) ==# 4
" {'a':{'aa':1},'b':2}+{'a':{'ab':2]}={'a':{'aa':1,'ab':2},'b':2}
if has_key(l:lhs, l:key)
call s:extend(l:lhs[l:key], l:rhs[l:key])
else
let l:lhs[l:key] = l:rhs[l:key]
endif
else
" {'a':{'aa':1},'b':2}+{'a':1}={'a':1,'b':2}
let l:lhs[l:key] = l:rhs[l:key]
endif
endfor
endif
endif
return l:lhs
endfunction
function! lsp_settings#utils#extend(lhs, rhs) abort
return s:extend(a:lhs, a:rhs)
endfunction
function! lsp_settings#utils#shellescape(path) abort
let l:quote = &shellxquote ==# '"' ? "'" : '"'
return l:quote . a:path . l:quote
endfunction
function! lsp_settings#utils#open_url(url) abort
if exists('g:loaded_openbrowser') && g:loaded_openbrowser
call openbrowser#open(a:url)
elseif has('win32') || has('win64')
silent! exec printf('!start rundll32 url.dll,FileProtocolHandler %s', a:url)
elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin'
call system(printf('open "%s"', a:url))
elseif executable('xdg-open')
call system(printf('xdg-open "%s"', a:url))
elseif executable('firefox')
call system(printf('firefox "%s"', a:url))
else
return v:false
endif
return v:true
endfunction

View File

@@ -0,0 +1,8 @@
function! LspCheckCommand() abort
let l:command = trim(filter(systemlist('ros version'), 'v:val =~# "^homedir="')[0][8:], '''"') . '/bin/cl-lsp'
if !filereadable(l:command)
return ''
endif
call lsp_settings#set('cl-lsp', 'cmd', ['ros', '-Q', '--', l:command])
return l:command
endfunction

View File

@@ -0,0 +1,7 @@
function! LspCheckCommand() abort
call system('perl -e "use Perl::LanguageServer"')
if v:shell_error
return ''
endif
return 'perl -MPerl::LanguageServer -e "Perl::LanguageServer->run"'
endfunction

View File

@@ -0,0 +1,3 @@
function! LspCheckCommand() abort
return lsp_settings#exec_path('slp')
endfunction

View File

@@ -0,0 +1,7 @@
# data
## catalog.json
JSON Schemas
https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/api/json/catalog.json

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
:LspSettingsGlobalEdit vim-lsp-settings.txt /*:LspSettingsGlobalEdit*
:LspSettingsLocalEdit vim-lsp-settings.txt /*:LspSettingsLocalEdit*
:LspSettingsStatus vim-lsp-settings.txt /*:LspSettingsStatus*
LspInstallServer vim-lsp-settings.txt /*LspInstallServer*
LspUninstallServer vim-lsp-settings.txt /*LspUninstallServer*
g:lsp_settings_deny_local_keys vim-lsp-settings.txt /*g:lsp_settings_deny_local_keys*
g:lsp_settings_enable_suggestions vim-lsp-settings.txt /*g:lsp_settings_enable_suggestions*
g:lsp_settings_global_settings_dir vim-lsp-settings.txt /*g:lsp_settings_global_settings_dir*
g:lsp_settings_servers_dir vim-lsp-settings.txt /*g:lsp_settings_servers_dir*
vim-lsp-settings vim-lsp-settings.txt /*vim-lsp-settings*
vim-lsp-settings-configuration vim-lsp-settings.txt /*vim-lsp-settings-configuration*
vim-lsp-settings-contents vim-lsp-settings.txt /*vim-lsp-settings-contents*
vim-lsp-settings-installation vim-lsp-settings.txt /*vim-lsp-settings-installation*
vim-lsp-settings-introduction vim-lsp-settings.txt /*vim-lsp-settings-introduction*
vim-lsp-settings.txt vim-lsp-settings.txt /*vim-lsp-settings.txt*

View File

@@ -0,0 +1,181 @@
*vim-lsp-settings.txt*
*vim-lsp-settings*
-------------------------------------------------------
Auto configurations for Language Server for vim-lsp
-------------------------------------------------------
Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Repository: https://github.com/mattn/vim-lsp-settings
License: MIT
==============================================================================
CONTENTS *vim-lsp-settings-contents*
1. Introduction..............................|vim-lsp-settings-introduction|
2. Installation..............................|vim-lsp-settings-installation|
3. Install Language Server...............................|:LspInstallServer|
4. Uninstall Language Server...........................|:LspUninstallServer|
5. Configuration............................|vim-lsp-settings-configuration|
==============================================================================
INTRODUCTION *vim-lsp-settings-introduction*
vim-lsp-settings is a plugin to improve vim-lsp.
* Easy to install Language Servers.
* Easy to uninstall Language Servers.
* Auto-configuration for Language Servers.
* Extra useful commands.
==============================================================================
INSTALLATION *vim-lsp-settings-installation*
Manual installation:
Copy the files to your .vim directory (_vimfiles on Windows).
Run :PluginInstall
NeoBundle: add below to .vimrc
>
NeoBundle 'mattn/vim-lsp-settings'
<
Run :NeoBundleInstall
vim-plug: add below to .vimrc
>
Plug 'mattn/vim-lsp-settings' to .vimrc
<
Run :PlugInstall
==============================================================================
INSTALL LANGUAGE SERVER *LspInstallServer*
To install Language Server, you need to open the source file. The filetype
should be set correctly. Then |:LspInstallServer|. |:LspInstallServer| can be
taken an argument for the name of Language Server installable.
>
:LspInstallServer pyls
<
If you want to update Language Server, please do |:LspInstallServer| again.
==============================================================================
UNINSTALL LANGUAGE SERVER *LspUninstallServer*
To uninstall Language Server, do |:LspUninstallServer|.
>
:LspUninstallServer pyls
<
==============================================================================
CONFIGURATION *vim-lsp-settings-configuration*
vim-lsp-settings have two way configurations. One way is write with Vim
script. You can modify configuration like below:
>
let g:lsp_settings = {
\ 'r-languageserver': {
\ 'cmd': ['c:\Program Files\R\R-3.6.2\bin\R.exe', '--slave', '-e', 'languageserver::run()'],
\ },
\ 'sqls1': {
\ 'initialization_options': function('s:sqls_selector'),
\ },
\ 'perl-languageserver': {
\ 'disabled': 0,
\ },
\ 'efm-langserver': {
\ 'blocklist': ['', 'twitvim'],
\ 'disabled': 0,
\ },
\ 'yaml-language-server': {
\ 'workspace_config': {
\ 'yaml': {
\ 'schemas': {
\ 'https://mattn.github.io/efm-langserver/schema.json': '/efm-langserver/config.yaml'
\ },
\ 'completion': v:true,
\ 'hover': v:true,
\ 'validate': v:true,
\ }
\ }
\ },
\}
<
Tips: If you want to only add/replace arguments for the server,
>
let g:lsp_settings = {
\ 'some-langserver': {
\ 'args': ['foo', 'bar', 'baz'],
\ },
\}
<
If you want to add extra schemas for yaml-language-server or
json-language-server, do |:LspSettingsLocalEdit| or |:LspSettingsGlobalEdit|
and put schemas property like below:
>
{
"yaml-language-server": {
"schemas": [
{
"fileMatch":["my-config.yaml"],
"url": "https://example.com/my-config-schema.json"
},
{
"fileMatch":["your-config.yaml"],
"url": "https://example.com/your-config-schema.json"
}
]
}
}
<
*g:lsp_settings_enable_suggestions*
g:lsp_settings_enable_suggestions
Default: 1
Set 0 only if you'd like to opt-out "Please do :LspInstallServer to enable
Language Server" suggestion messages.
*g:lsp_settings_servers_dir*
g:lsp_settings_servers_dir
Default:
%LOCALAPPDATA%\vim-lsp-settings\servers (Windows)
$HOME/.local/share/vim-lsp-settings/servers (Non-Windows)
$XDG_DATA_HOME/vim-lsp-settings/servers ($XDG_DATA_HOME defined Non-Windows)
When value defined, store server file under these directory.
*g:lsp_settings_global_settings_dir*
g:lsp_settings_global_settings_dir
Default:
%LOCALAPPDATA%\vim-lsp-settings (Windows)
$HOME/.local/share/vim-lsp-settings (Non-Windows)
$XDG_DATA_HOME/vim-lsp-settings ($XDG_DATA_HOME defined Non-Windows)
When value defined, store global settings under these directory.
*g:lsp_settings_deny_local_keys*
g:lsp_settings_deny_local_keys
Default: ['cmd']
vim-lsp-settings load local settings from .vim-lsp-settings but it might be
dangerous when the git repository contains the directory same named.
This variable is specified name of settings like 'cmd' to drop items in the
settings.
:LspSettingsLocalEdit [root] *:LspSettingsLocalEdit*
Edit local settings. Accepts an optional explicit [root] directory that
contains the .vim-lsp-settings config directory.
[root] is path to the vim-lsp-settings plugin if omitted.
:LspSettingsGlobalEdit *:LspSettingsGlobalEdit*
Edit global settings.
You can use the :LspSettingsStatus command to inspect the current config.
:LspSettingsStatus *:LspSettingsStatus*
Print a status dump of information about the language server configured for
the current buffer.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

View File

@@ -0,0 +1,16 @@
root = true
# All
[*]
charset = utf-8
# Extension
[*.sh]
end_of_line = lf
indent_style = space
indent_size = 2
[*.cmd]
end_of_line = crlf
# EOF

View File

@@ -0,0 +1 @@
ref: refs/heads/master

View File

@@ -0,0 +1,11 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/mattn/vim-lsp-settings.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View File

@@ -0,0 +1,174 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}

View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View File

@@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View File

@@ -0,0 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View File

@@ -0,0 +1,53 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View File

@@ -0,0 +1,169 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View File

@@ -0,0 +1,42 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View File

@@ -0,0 +1,78 @@
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi

View File

@@ -0,0 +1,128 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

Binary file not shown.

View File

@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 b5c674592a89bff3539192ec26e84383dd68ab4a LinlyBoi <libkyy@e.email> 1676062730 +0200 clone: from https://github.com/mattn/vim-lsp-settings.git
b5c674592a89bff3539192ec26e84383dd68ab4a b5c674592a89bff3539192ec26e84383dd68ab4a LinlyBoi <libkyy@e.email> 1676062731 +0200 checkout: moving from master to master

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 b5c674592a89bff3539192ec26e84383dd68ab4a LinlyBoi <libkyy@e.email> 1676062730 +0200 clone: from https://github.com/mattn/vim-lsp-settings.git

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 b5c674592a89bff3539192ec26e84383dd68ab4a LinlyBoi <libkyy@e.email> 1676062730 +0200 clone: from https://github.com/mattn/vim-lsp-settings.git

View File

@@ -0,0 +1,18 @@
# pack-refs with: peeled fully-peeled sorted
b0d2115058e38e73a8520808ef07c05f74f35421 refs/remotes/origin/add-sqls
597b8da5bdcc2189948273e29e613eab653dca43 refs/remotes/origin/angular
210b712020be3ee6467e23e8acfd0f28944c8455 refs/remotes/origin/awk-language-server
c4efee0804d0a5c2dea355ae5bbd883bb41a17d9 refs/remotes/origin/daggerlsp
26b51965dd7728338c29868739a2c6ed1d2ab13e refs/remotes/origin/fix-177
7a40df647edbc25c8358d3965fac332c4a77c930 refs/remotes/origin/fix-deno
65e078604b6a7bb8dc9e28229548fa8374510e1d refs/remotes/origin/fix-yaml
5a9a1bdc182e8c5ade75bc91ec112d105abb37c7 refs/remotes/origin/glslls
4abb22f2eb5ab7afe0ce080d6126b71cd7483124 refs/remotes/origin/ijaas
ca187115385a8cf1c5d1aa11c2be05853646c70e refs/remotes/origin/json-languageserver-2
b5c674592a89bff3539192ec26e84383dd68ab4a refs/remotes/origin/master
080a9a4be194f938a4ee0cf0ebf3ae2d76b0acaf refs/remotes/origin/openscad-lsp
9a51708ec28c9475d52c486f67e8f85c353ed31c refs/remotes/origin/rucoa
db44714704ca351c5b777018a5a079e945f60559 refs/remotes/origin/templ
4c190d46afac1756aa8838818100e4d92207beef refs/remotes/origin/update-servers
58a139a8308aca6de3d1bebe4c2f7d87e7345fce refs/remotes/origin/zeta-note
70d4458905da0a22ad439884da73606a5ccc6bd2 refs/tags/v0.0.1

View File

@@ -0,0 +1 @@
b5c674592a89bff3539192ec26e84383dd68ab4a

View File

@@ -0,0 +1 @@
ref: refs/remotes/origin/master

View File

@@ -0,0 +1,17 @@
080a9a4be194f938a4ee0cf0ebf3ae2d76b0acaf
210b712020be3ee6467e23e8acfd0f28944c8455
26b51965dd7728338c29868739a2c6ed1d2ab13e
4abb22f2eb5ab7afe0ce080d6126b71cd7483124
4c190d46afac1756aa8838818100e4d92207beef
58a139a8308aca6de3d1bebe4c2f7d87e7345fce
597b8da5bdcc2189948273e29e613eab653dca43
5a9a1bdc182e8c5ade75bc91ec112d105abb37c7
65e078604b6a7bb8dc9e28229548fa8374510e1d
70d4458905da0a22ad439884da73606a5ccc6bd2
7a40df647edbc25c8358d3965fac332c4a77c930
9a51708ec28c9475d52c486f67e8f85c353ed31c
b0d2115058e38e73a8520808ef07c05f74f35421
b5c674592a89bff3539192ec26e84383dd68ab4a
c4efee0804d0a5c2dea355ae5bbd883bb41a17d9
ca187115385a8cf1c5d1aa11c2be05853646c70e
db44714704ca351c5b777018a5a079e945f60559

View File

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix
# git system files
.gitattributes eol=lf
.gitignore eol=lf
.editorconfig eol=lf
*.sh text eol=lf
*.cmd -text
# EOF

View File

@@ -0,0 +1,39 @@
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
version: [stable, nightly]
vim_type: ['Vim', 'Neovim']
include:
- vim_type: 'Vim'
neovim: false
- vim_type: 'Neovim'
neovim: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- id: vim
uses: rhysd/action-setup-vim@v1
with:
version: ${{ matrix.version }}
neovim: ${{ matrix.neovim }}
- name: 'Setup vim-themis'
uses: actions/checkout@v2
with:
repository: thinca/vim-themis
path: vim-themis
- name: Run tests
env:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
run: |
./vim-themis/bin/themis ./test

View File

@@ -0,0 +1,35 @@
name: reviewdog
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
vimlint:
name: runner / vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: vint
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
level: error
reporter: github-pr-review
shellcheck:
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: "."
pattern: "*.sh"
exclude: "./.git/*"

View File

@@ -0,0 +1,5 @@
servers/*
unzip.exe
gzip.exe
busybox.exe
doc/tags

View File

@@ -0,0 +1,10 @@
#!/bin/sh
# Usage
# $ go_install [GO_GET_URLPATH]
set -e
GOPATH=$(pwd) GOBIN=$(pwd) GO111MODULE=on go install -v "$1"
GOPATH=$(pwd) GO111MODULE=on go clean -modcache
rm -rf src pkg 2>/dev/null

View File

@@ -0,0 +1,29 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="linux"
;;
darwin)
platform="macos"
;;
esac
filename="dartsdk-$platform-x64-release.zip"
curl -o "$filename" "https://storage.googleapis.com/dart-archive/channels/dev/release/latest/sdk/dartsdk-$platform-x64-release.zip"
unzip "$filename"
rm "$filename"
cat <<EOF >analysis-server-dart-snapshot
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)/dart-sdk
\$DIR/bin/dart language-server \$*
EOF
chmod +x analysis-server-dart-snapshot

View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" tsserver typescript
"$(dirname "$0")/npm_install.sh" angular-language-server @angular/language-server
cat <<EOF >angular-language-server
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
node \$DIR/node_modules/@angular/language-server/index.js --ngProbeLocations \$DIR/node_modules/@angular/language-service --tsProbeLocations \$DIR/node_modules/typescript \$*
EOF
chmod +x angular-language-server

View File

@@ -0,0 +1,11 @@
#!/bin/sh
curl -o apex-jorje-lsp.jar -L "https://github.com/forcedotcom/salesforcedx-vscode/blob/develop/packages/salesforcedx-vscode-apex/out/apex-jorje-lsp.jar?raw=true"
cat <<EOF >apex-jorje-lsp
DIR=\$(cd \$(dirname \$0); pwd)
java -jar \$DIR/apex-jorje-lsp.jar %%* ^
EOF
chmod +x apex-jorje-lsp

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" astro-ls @astrojs/language-server

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" bash-language-server bash-language-server

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/go_install.sh" github.com/bufbuild/buf-language-server/cmd/bufls@latest

View File

@@ -0,0 +1,3 @@
#!/bin/sh
ros install cxxxr/lem cxxxr/cl-lsp

View File

@@ -0,0 +1,117 @@
#!/bin/sh
set -e
# On MacOS, use clangd in Command Line Tools for Xcode.
if command -v xcrun 2>/dev/null && xcrun --find clangd 2>/dev/null; then
cat <<'EOF' >clangd
#!/bin/sh
exec xcrun --run clangd "$@"
EOF
chmod +x clangd
exit
fi
if command -v lsb_release 2>/dev/null; then
distributor_id=$(lsb_release -a 2>&1 | grep 'Distributor ID' | awk '{print $3}')
elif [ -e /etc/fedora-release ]; then
distributor_id="Fedora"
elif [ -e /etc/redhat-release ]; then
distributor_id=$(cut -d ' ' -f 1 /etc/redhat-release)
elif [ -e /etc/arch-release ]; then
distributor_id="Arch"
elif [ -e /etc/SuSE-release ]; then
distributor_id="SUSE"
elif [ -e /etc/mandriva-release ]; then
distributor_id="Mandriva"
elif [ -e /etc/vine-release ]; then
distributor_id="Vine"
elif [ -e /etc/gentoo-release ]; then
distributor_id="Gentoo"
else
distributor_id="Unknown"
fi
filename() {
distributor_id=$1
version=$2
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="pc-linux-gnu"
;;
darwin)
platform="apple-darwin"
;;
esac
case $distributor_id in
# Check Ubuntu version
Ubuntu)
ubuntu_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $ubuntu_version in
14.04 | 16.04 | 18.04 | 20.04)
platform="linux-gnu-ubuntu-$ubuntu_version"
;;
22.04)
platform="linux-gnu-ubuntu-20.04"
;;
esac
;;
# Check LinuxMint version
LinuxMint)
linuxmint_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $linuxmint_version in
19 | 19.1 | 19.2 | 19.3)
platform="linux-gnu-ubuntu-18.04"
;;
18 | 18.1 | 18.2 | 18.3)
platform="linux-gnu-ubuntu-16.04"
;;
esac
;;
# Check RedHat OS version
Fedora | Oracle | CentOS)
case $version in
9.0.0 | 10.0.0)
platform="linux-sles11.3"
;;
11.0.0)
platform="linux-sles12.4"
;;
esac
;;
esac
# Check Architecture
arch=$(uname -m)
case $arch in
aarch64)
platform="linux-gnu"
;;
esac
echo "clang+llvm-$version-$arch-$platform"
}
# Search for an installable clang+llvm release.
for llvm_version in 15 14 13 12 11 10 9; do
filename="$(filename "$distributor_id" "$llvm_version.0.0")"
url="https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvm_version.0.0/$filename.tar.xz"
response_code=$(curl -sIL "${url}" -o /dev/null -w "%{response_code}")
# If version exists, install it and exit.
if [ "${response_code}" -ne "404" ]; then
echo "Downloading clangd and LLVM $llvm_version..."
curl -L "$url" | unxz | tar x --strip-components=1 "$filename"/
ln -sf bin/clangd .
./clangd --version
exit 0
fi
done
echo "Could not find an installable clangd release!"
exit 1

View File

@@ -0,0 +1,3 @@
#!/bin/sh
VERSION="2020.05.09"
curl -L -o clj-kondo-lsp https://github.com/borkdude/clj-kondo/releases/download/v$VERSION/clj-kondo-lsp-server-$VERSION-standalone.jar

View File

@@ -0,0 +1,51 @@
#!/bin/sh
set -e
os="$(uname -s | tr "[:upper:]" "[:lower:]")"
arch="$(uname -m)"
case $os in
linux)
os_fixed="linux"
if [ "$arch" = "x86_64" ]; then
platform="amd64"
elif [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then
platform="aarch64"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
darwin)
os_fixed="macos"
if [ "$arch" = "x86_64" ]; then
platform="amd64"
elif [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then
platform="aarch64"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
mingw64_nt*)
os_fixed="windows"
if [ "$arch" = "x86_64" ]; then
platform="amd64"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
*)
echo "unknow platform: $os"
exit 1
;;
esac
version="latest"
filename="clojure-lsp-native-${os_fixed}-${platform}.zip"
url="https://github.com/clojure-lsp/clojure-lsp/releases/${version}/download/${filename}"
curl -L -O ${url}
unzip ${filename}
chmod +x clojure-lsp

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/pip_install.sh" cmake-language-server cmake-language-server

View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
version="0.9.1"
url="https://github.com/eclipse/che-che4z-lsp-for-cobol/releases/download/$version/cobol-language-support-$version.vsix"
filename="cobol-language-support-$version.vsix"
curl -L "$url" -o "$filename"
unzip "$filename"
rm "$filename"
cat <<EOF >./cobol-language-support
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
java "-Dline.speparator=\r\n" -jar "\$DIR/extension/server/lsp-service-cobol-$version.jar" pipeEnabled
EOF
chmod +x ./cobol-language-support

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" css-languageserver vscode-css-languageserver-bin

View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
filename="deno-x86_64-unknown-linux-gnu.zip"
;;
darwin)
if [ "$(uname -m)" = "x86_64" ]; then
filename="deno-x86_64-apple-darwin.zip"
else
filename="deno-aarch64-apple-darwin.zip"
fi
;;
esac
curl -L -o "deno-$os.zip" "https://github.com/denoland/deno/releases/latest/download/$filename"
unzip "deno-$os.zip"

View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux) ;;
darwin)
os="osx"
;;
*)
printf "%s doesn't supported by bash installer" "$os"
exit 1
;;
esac
version="v0.26.2"
url="https://github.com/d-language-server/dls/releases/download/$version/dls-$version.$os.x86_64.zip"
curl -LO "$url"
unzip "dls-$version.$os.x86_64.zip"

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" docker-langserver dockerfile-language-server-nodejs

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" dot-language-server dot-language-server

View File

@@ -0,0 +1,25 @@
#!/bin/sh
set -e
curl -o jdt-language-server-latest.tar.gz 'https://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz'
curl -o lombok.jar 'https://projectlombok.org/downloads/lombok.jar'
tar xvf jdt-language-server-latest.tar.gz
rm jdt-language-server-latest.tar.gz
osType="$(uname -s)"
echo "$osType"
case "$osType" in
Darwin*) configDir=config_mac ;;
Linux*) configDir=config_linux ;;
*) configDir=config_linux ;;
esac
cat <<EOF >eclipse-jdt-ls
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
LAUNCHER=\$(ls \$DIR/plugins/org.eclipse.equinox.launcher_*.jar)
java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -javaagent:\$DIR/lombok.jar -Xbootclasspath/a:\$DIR/lombok.jar -jar \$LAUNCHER -configuration \$DIR/$configDir -data \$DIR/data
EOF
chmod +x eclipse-jdt-ls

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/go_install.sh" github.com/mattn/efm-langserver@latest

View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
version="v0.12.0"
url="https://github.com/elixir-lsp/elixir-ls/releases/download/$version/elixir-ls.zip"
curl -LO "$url"
unzip elixir-ls.zip
rm elixir-ls.zip
cat <<EOF >elixir-ls
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
\$DIR/language_server.sh \$*
EOF
chmod +x language_server.sh
chmod +x elixir-ls

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" elm-language-server "@elm-tooling/elm-language-server"

View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
version="0.3.6"
curl -L -o EmmyLua-LS-all.jar "https://github.com/EmmyLua/EmmyLua-LanguageServer/releases/download/$version/EmmyLua-LS-all.jar"
cat <<EOF >emmylua-ls
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
java -cp \$DIR/EmmyLua-LS-all.jar com.tang.vscode.MainKt
EOF
chmod +x emmylua-ls

View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
git clone --depth=1 https://github.com/erlang-ls/erlang_ls .
make
ln -s ./_build/default/bin/erlang_ls erlang-ls

View File

@@ -0,0 +1,16 @@
#!/bin/sh
set -e
python3 -m venv ./venv
./venv/bin/pip3 install -U pip
./venv/bin/pip3 install "esbonio[lsp]"
cat <<EOF >esbonio
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
\$DIR/venv/bin/python3 -m esbonio
EOF
chmod +x esbonio

View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
version="2.1.0"
url="https://github.com/microsoft/vscode-eslint/releases/download/release%2F$version-next.1/vscode-eslint-$version.vsix"
asset="vscode-eslint.vsix"
curl -L "$url" -o "$asset"
unzip "$asset"
rm "$asset"
cat <<EOF >eslint-language-server
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
node \$DIR/extension/server/out/eslintServer.js \$*
EOF
chmod +x eslint-language-server

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" flow flow-bin

View File

@@ -0,0 +1,3 @@
#!/bin/sh
"$(dirname "$0")/pip_install.sh" fortls fortran-language-server

View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
if command -v dotnet >/dev/null 2>&1; then
echo "dotnet installed"
dotnetcmd=dotnet
else
echo "dotnet not found, installing..."
# REF https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/pyls_ms.lua
curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -i "./.dotnet"
dotnetcmd="\\$DIR/.dotnet/dotnet"
fi
$dotnetcmd tool install --tool-path . fsautocomplete

View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
git clone --depth=1 https://github.com/fsprojects/fsharp-language-server .
npm install
dotnet tool install --global paket
dotnet tool restore
dotnet publish src/FSharpLanguageServer --configuration Release --output Publish
cat <<EOF >fsharp-language-server
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
dotnet \$DIR/Publish/FSharpLanguageServer.dll \$*
EOF
chmod +x fsharp-language-server

View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -e
"$(dirname "$0")/go_install.sh" github.com/nametake/golangci-lint-langserver@latest
"$(dirname "$0")/go_install.sh" github.com/golangci/golangci-lint/cmd/golangci-lint@latest

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/go_install.sh" golang.org/x/tools/gopls@latest

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" gql-language-server @playlyfe/gql-language-server

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
if [ ! -f package.json ]; then
# Avoid the problem of not being able to install the same package as name in package.json.
# Create an empty package.json.
npm init -y
echo '{"name": ""}' >package.json
fi
npm install "graphql-language-service-cli"
ln -s "./node_modules/.bin/graphql-lsp" graphql-language-server

View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
git clone --depth=1 https://github.com/prominic/groovy-language-server .
./gradlew build
cat <<EOF >groovy-language-server
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
java -jar \$DIR/build/libs/groovy-language-server-all.jar \$*
EOF
chmod +x groovy-language-server

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" html-languageserver vscode-html-languageserver-bin

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" intelephense intelephense

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" javascript-typescript-stdio javascript-typescript-langserver

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
"$(dirname "$0")/pip_install.sh" jedi-language-server jedi-language-server

View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -e
"$(dirname "$0")/npm_install.sh" vscode-json-languageserver vscode-json-languageserver
ln -s vscode-json-languageserver json-languageserver

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
julia -e 'using Pkg; Pkg.add("LanguageServer")'
cat <<EOF >julia-language-server
#!/bin/sh
julia -e "using LanguageServer, LanguageServer.SymbolServer; runserver()"
EOF
chmod +x julia-language-server

View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -e
version="0.5.2"
curl -L -o server.zip "https://github.com/fwcd/kotlin-language-server/releases/download/$version/server.zip"
unzip server.zip
rm server.zip
ln -s server/bin/kotlin-language-server .

View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
version="0.14.1"
url="https://repo.eclipse.org/content/repositories/lemminx-releases/org/eclipse/lemminx/org.eclipse.lemminx/${version}/org.eclipse.lemminx-${version}-uber.jar"
lemminx_jar="org.eclipse.lemminx-${version}-uber.jar"
curl -L "$url" -o "${lemminx_jar}"
cat <<EOF >lemminx
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
java -jar \$DIR/${lemminx_jar}
EOF
chmod +x lemminx

View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="linux"
;;
darwin)
platform="macos"
;;
esac
curl -L -o marksman "https://github.com/artempyanykh/marksman/releases/latest/download/marksman-$platform"
chmod +x marksman

View File

@@ -0,0 +1,36 @@
#!/bin/sh
set -e
curl -Lo ./coursier https://git.io/coursier-cli
chmod +x ./coursier
version=$(curl -LsS "https://scalameta.org/metals/latests.json" | grep -o '"release": "[^"]*"' | grep -o '[\.0-9]*')
java_flags=
if [ -n "${https_proxy}" ]; then
https_proxy_without_protocol="${https_proxy#http://}"
java_flags="$java_flags -J-Dhttps.proxyHost=${https_proxy_without_protocol%:*}"
java_flags="$java_flags -J-Dhttps.proxyPort=${https_proxy_without_protocol##*:}"
fi
if [ -n "${http_proxy}" ]; then
http_proxy_without_protocol="${http_proxy#http://}"
java_flags="$java_flags -J-Dhttp.proxyHost=${http_proxy_without_protocol%:*}"
java_flags="$java_flags -J-Dhttp.proxyPort=${http_proxy_without_protocol##*:}"
fi
if [ -n "${no_proxy}" ]; then
java_flags="$java_flags -J-Dhttp.nonProxyHosts=${no_proxy}"
fi
# shellcheck disable=SC2086
./coursier bootstrap \
--java-opt -Xss4m \
--java-opt -Xms100m \
${java_flags} \
org.scalameta:metals_2.13:"${version}" \
-r bintray:scalacenter/releases \
-r sonatype:releases \
-o metals -f

View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -e
nimble -y --nimbledir="$(pwd)" install nimlsp
ln -s "$(pwd)/bin/nimlsp" .

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
#set -o pipefail
os="$(uname -s | tr "[:upper:]" "[:lower:]")"
case "${os}" in
darwin | linux)
url="https://github.com/nokia/ntt/releases/latest/download/ntt_${os}_x86_64.tar.gz"
curl -L "$url" | tar xz ntt
chmod +x ntt
;;
*)
echo >&2 "$os is not supported"
exit 1
;;
esac

View File

@@ -0,0 +1,26 @@
#!/bin/sh
set -e
DEFAULT_DIR="$(pwd)"
# We should not download GitHub's zip file here, because it doesn't include some submodules.
git clone --recurse-submodules http://github.com/ocaml/ocaml-lsp.git ocaml-lsp-files --depth=1
cd ocaml-lsp-files
rm -r lsp/test
OPAMROOT="$(pwd)/.opam"
export OPAMROOT
export OPAMYES=true
opam init -a -n
opam switch create . ocaml-base-compiler.4.14.0
eval "$(opam env)" 2>/dev/null
opam exec make install-test-deps
opam exec make all
rm -rf .git
cd "$DEFAULT_DIR"
ln -snf "./ocaml-lsp-files/_build/default/ocaml-lsp-server/bin/main.exe" ocaml-lsp
chmod +x ocaml-lsp

View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -e
git clone --depth=1 https://github.com/DanielGavin/ols_
cd ols_ && ./build.sh && cp ols .. && cd .. && rm -rf ols_

View File

@@ -0,0 +1,64 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
arch="-x64"
net6=""
version=$(dotnet --version)
case $os in
linux) ;;
darwin)
os="osx"
arch=""
;;
*)
printf "%s doesn't supported by bash installer" "$os"
exit 1
;;
esac
case $version in
*.*)
mainVersion=${version%%.*}
;;
*)
mainVersion=$version
;;
esac
if [ "$mainVersion" -ge "6" ]; then
net6="-net6.0"
if [ "$os" = "osx" ]; then
if [ "$(uname -m)" = "x86_64" ]; then
arch="-x64"
else
arch="-$(uname -m)"
fi
fi
cat <<EOF >run
#!/bin/sh
base_dir="\$(cd "\$(dirname "\$0")" && pwd -P)"
omnisharp_cmd=\${base_dir}/OmniSharp
"\${omnisharp_cmd}" "\$@"
EOF
fi
url="https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-$os$arch$net6.tar.gz"
curl -L "$url" | tar xz
chmod +x run
cat <<EOF >omnisharp-lsp
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
\$DIR/run \$*
EOF
chmod +x omnisharp-lsp

View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux) ;;
darwin)
os="macos"
;;
*)
printf "%s doesn't supported by bash installer" "$os"
exit 1
;;
esac
curl -L -o "perlnavigator-$os-x86_64.zip" "https://github.com/bscan/PerlNavigator/releases/latest/download/perlnavigator-$os-x86_64.zip"
unzip "perlnavigator-$os-x86_64.zip"
mv "perlnavigator-$os-x86_64/perlnavigator" .
rm -rf "perlnavigator-$os-x86_64" "perlnavigator-$os-x86_64.zip"

Some files were not shown because too many files have changed in this diff Show More