forked from dense-analysis/ale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into fix-swipl
* origin/master: (40 commits) fix: correct suggested filetype for yamlfix feat: add yamlfix fixer Use _config for LSP config options Add support for R languageserver (dense-analysis#3370) Fix 3103 - add shellcheck shell directive detection. (dense-analysis#3216) Added the Vundle command in installation instructions (dense-analysis#3400) Adds support for Tlint - A Tighten Opinionated PHP Linter (dense-analysis#3291) Add php phpcbf options (dense-analysis#3383) Use has('gui_running') instead of has('gui') Close dense-analysis#2727 - Add a hover-only setting for balloons Fix dense-analysis#3332 - Modify everything for rename/actions Add a missing blank line in documentation Add luafmt fixer (dense-analysis#3289) dense-analysis#3442 Fix code fix clangd issue Close dense-analysis#1466 - Add GVIM refactor menu support Look for node packages in .yarn/sdks as well Update documentation for code actions and rename cmp forwards, and reverse the code actions Support for LSP/tsserver Code Actions (dense-analysis#3437) Move the test for buffer-local variables ...
- Loading branch information
Showing
73 changed files
with
2,578 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com> | ||
" Description: Elvis linter for Erlang files | ||
|
||
call ale#Set('erlang_elvis_executable', 'elvis') | ||
|
||
function! ale_linters#erlang#elvis#Handle(buffer, lines) abort | ||
let l:pattern = '\v:(\d+):[^:]+:(.+)' | ||
let l:loclist = [] | ||
|
||
for l:match in ale#util#GetMatches(a:lines, l:pattern) | ||
call add(l:loclist, { | ||
\ 'lnum': str2nr(l:match[1]), | ||
\ 'text': s:AbbreviateMessage(l:match[2]), | ||
\ 'type': 'W', | ||
\}) | ||
endfor | ||
|
||
return l:loclist | ||
endfunction | ||
|
||
function! s:AbbreviateMessage(text) abort | ||
let l:pattern = '\v\c^(line \d+ is too long):.*$' | ||
|
||
return substitute(a:text, l:pattern, '\1.', '') | ||
endfunction | ||
|
||
function! s:GetCommand(buffer) abort | ||
let l:file = ale#Escape(expand('#' . a:buffer . ':.')) | ||
|
||
return '%e rock --output-format=parsable ' . l:file | ||
endfunction | ||
|
||
call ale#linter#Define('erlang', { | ||
\ 'name': 'elvis', | ||
\ 'callback': 'ale_linters#erlang#elvis#Handle', | ||
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')}, | ||
\ 'command': function('s:GetCommand'), | ||
\ 'lint_file': 1, | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
" Author: Eric Stern <eric@ericstern.com>, | ||
" Arnold Chand <creativenull@outlook.com> | ||
" Description: Intelephense language server integration for ALE | ||
|
||
call ale#Set('php_intelephense_executable', 'intelephense') | ||
call ale#Set('php_intelephense_use_global', 1) | ||
call ale#Set('php_intelephense_config', {}) | ||
|
||
function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort | ||
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') | ||
|
||
if (!empty(l:composer_path)) | ||
return fnamemodify(l:composer_path, ':h') | ||
endif | ||
|
||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') | ||
|
||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' | ||
endfunction | ||
|
||
function! ale_linters#php#intelephense#GetInitializationOptions() abort | ||
return ale#Get('php_intelephense_config') | ||
endfunction | ||
|
||
call ale#linter#Define('php', { | ||
\ 'name': 'intelephense', | ||
\ 'lsp': 'stdio', | ||
\ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), | ||
\ 'executable': {b -> ale#node#FindExecutable(b, 'php_intelephense', [])}, | ||
\ 'command': '%e --stdio', | ||
\ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
" Author: Jose Soto <jose@tighten.co> | ||
" | ||
" Description: Tighten Opinionated PHP Linting | ||
" Website: https://github.com/tightenco/tlint | ||
|
||
call ale#Set('php_tlint_executable', 'tlint') | ||
call ale#Set('php_tlint_use_global', get(g:, 'ale_use_global_executables', 0)) | ||
call ale#Set('php_tlint_options', '') | ||
|
||
function! ale_linters#php#tlint#GetProjectRoot(buffer) abort | ||
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') | ||
|
||
if !empty(l:composer_path) | ||
return fnamemodify(l:composer_path, ':h') | ||
endif | ||
|
||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') | ||
|
||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' | ||
endfunction | ||
|
||
function! ale_linters#php#tlint#GetExecutable(buffer) abort | ||
return ale#node#FindExecutable(a:buffer, 'php_tlint', [ | ||
\ 'vendor/bin/tlint', | ||
\ 'tlint', | ||
\]) | ||
endfunction | ||
|
||
function! ale_linters#php#tlint#GetCommand(buffer) abort | ||
let l:executable = ale_linters#php#tlint#GetExecutable(a:buffer) | ||
let l:options = ale#Var(a:buffer, 'php_tlint_options') | ||
|
||
return ale#node#Executable(a:buffer, l:executable) | ||
\ . (!empty(l:options) ? ' ' . l:options : '') | ||
\ . ' lint %s' | ||
endfunction | ||
|
||
function! ale_linters#php#tlint#Handle(buffer, lines) abort | ||
" Matches against lines like the following: | ||
" | ||
" ! There should be 1 space around `.` concatenations, and additional lines should always start with a `.` | ||
" 22 : ` $something = 'a'.'name';` | ||
" | ||
let l:loop_count = 0 | ||
let l:messages_pattern = '^\! \(.*\)' | ||
let l:output = [] | ||
let l:pattern = '^\(\d\+\) \:' | ||
let l:temp_messages = [] | ||
|
||
for l:message in ale#util#GetMatches(a:lines, l:messages_pattern) | ||
call add(l:temp_messages, l:message) | ||
endfor | ||
|
||
let l:loop_count = 0 | ||
|
||
for l:match in ale#util#GetMatches(a:lines, l:pattern) | ||
let l:num = l:match[1] | ||
let l:text = l:temp_messages[l:loop_count] | ||
|
||
call add(l:output, { | ||
\ 'lnum': l:num, | ||
\ 'col': 0, | ||
\ 'text': l:text, | ||
\ 'type': 'W', | ||
\ 'sub_type': 'style', | ||
\}) | ||
|
||
let l:loop_count += 1 | ||
endfor | ||
|
||
return l:output | ||
endfunction | ||
|
||
call ale#linter#Define('php', { | ||
\ 'name': 'tlint', | ||
\ 'executable': function('ale_linters#php#tlint#GetExecutable'), | ||
\ 'command': function('ale_linters#php#tlint#GetCommand'), | ||
\ 'callback': 'ale_linters#php#tlint#Handle', | ||
\ 'project_root': function('ale_linters#php#tlint#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com> | ||
" Description: https://github.com/pappasam/jedi-language-server | ||
|
||
call ale#Set('python_jedils_executable', 'jedi-language-server') | ||
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0)) | ||
call ale#Set('python_jedils_auto_pipenv', 0) | ||
|
||
function! ale_linters#python#jedils#GetExecutable(buffer) abort | ||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) | ||
\ && ale#python#PipenvPresent(a:buffer) | ||
return 'pipenv' | ||
endif | ||
|
||
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server']) | ||
endfunction | ||
|
||
function! ale_linters#python#jedils#GetCommand(buffer) abort | ||
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer) | ||
|
||
let l:exec_args = l:executable =~? 'pipenv$' | ||
\ ? ' run jedi-language-server' | ||
\ : '' | ||
|
||
return ale#Escape(l:executable) . l:exec_args | ||
endfunction | ||
|
||
call ale#linter#Define('python', { | ||
\ 'name': 'jedils', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': function('ale_linters#python#jedils#GetExecutable'), | ||
\ 'command': function('ale_linters#python#jedils#GetCommand'), | ||
\ 'project_root': function('ale#python#FindProjectRoot'), | ||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
" Author: Eric Zhao <21zhaoe@protonmail.com> | ||
" Description: Implementation of the Language Server Protocol for R. | ||
|
||
call ale#Set('r_languageserver_cmd', 'languageserver::run()') | ||
call ale#Set('r_languageserver_config', {}) | ||
|
||
function! ale_linters#r#languageserver#GetCommand(buffer) abort | ||
let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') | ||
|
||
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) | ||
endfunction | ||
|
||
function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort | ||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.Rprofile') | ||
|
||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h') | ||
endfunction | ||
|
||
call ale#linter#Define('r', { | ||
\ 'name': 'languageserver', | ||
\ 'lsp': 'stdio', | ||
\ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')}, | ||
\ 'executable': 'Rscript', | ||
\ 'command': function('ale_linters#r#languageserver#GetCommand'), | ||
\ 'project_root': function('ale_linters#r#languageserver#GetProjectRoot') | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.