summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorArnold Chand <creativenull@outlook.com>2021-07-25 00:39:56 -0400
committerGitHub <noreply@github.com>2021-07-25 13:39:56 +0900
commit8c591996a83d623fb158fe090acbd89dabbfaf06 (patch)
tree048374b84da988f9a31297538f978a3957bb96fe /autoload
parent7d8fb2ba1716a744446b811fc278ecf30d4eb771 (diff)
downloadale-8c591996a83d623fb158fe090acbd89dabbfaf06.zip
Add importMap option to deno Initialization Options (#3827)
* feat(deno): move init options to handlers * feat(deno): add deno lsp support for js files * feat(deno): use default map option * feat(docs): add deno import map option * feat(deno): add tests for importMap option * fix(deno): use full path in importMap * feat(deno): remove deno as linter for js, separate PR * fix(deno): test for executable * fix(deno-test): include filename to simplify function
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers/deno.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/handlers/deno.vim b/autoload/ale/handlers/deno.vim
index 4bf4546a..1b5e1718 100644
--- a/autoload/ale/handlers/deno.vim
+++ b/autoload/ale/handlers/deno.vim
@@ -1,8 +1,10 @@
" Author: Mohammed Chelouti - https://github.com/motato1
+" Arnold Chand <creativenull@outlook.com>
" Description: Handler functions for Deno.
call ale#Set('deno_executable', 'deno')
call ale#Set('deno_unstable', 0)
+call ale#Set('deno_importMap', 'import_map.json')
call ale#Set('deno_lsp_project_root', '')
function! ale#handlers#deno#GetExecutable(buffer) abort
@@ -50,3 +52,23 @@ function! ale#handlers#deno#GetProjectRoot(buffer) abort
return ''
endfunction
+
+" Initialization Options for deno, for javascript and typescript
+function! ale#handlers#deno#GetInitializationOptions(buffer) abort
+ let l:options = {
+ \ 'enable': v:true,
+ \ 'lint': v:true,
+ \ 'unstable': v:false,
+ \ 'importMap': ale#path#FindNearestFile(a:buffer, 'import_map.json'),
+ \ }
+
+ if ale#Var(a:buffer, 'deno_unstable')
+ let l:options.unstable = v:true
+ endif
+
+ if ale#Var(a:buffer, 'deno_importMap') isnot# ''
+ let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap'))
+ endif
+
+ return l:options
+endfunction