Ban use of ==# or ==? in the codebase, and prefer is# or is? instead
This commit is contained in:
parent
5010ddc28f
commit
a535d07f28
61 changed files with 158 additions and 154 deletions
|
@ -50,7 +50,7 @@ function! ale#Queue(delay, ...) abort
|
|||
|
||||
" Remember that we want to check files for this buffer.
|
||||
" We will remember this until we finally run the linters, via any event.
|
||||
if l:linting_flag ==# 'lint_file'
|
||||
if l:linting_flag is# 'lint_file'
|
||||
let s:should_lint_file_for_buffer[bufnr('%')] = 1
|
||||
endif
|
||||
|
||||
|
@ -157,7 +157,7 @@ endfunction
|
|||
" Escape a string suitably for each platform.
|
||||
" shellescape does not work on Windows.
|
||||
function! ale#Escape(str) abort
|
||||
if fnamemodify(&shell, ':t') ==? 'cmd.exe'
|
||||
if fnamemodify(&shell, ':t') is? 'cmd.exe'
|
||||
" If the string contains spaces, it will be surrounded by quotes.
|
||||
" Otherwise, special characters will be escaped with carets (^).
|
||||
return substitute(
|
||||
|
|
|
@ -9,7 +9,7 @@ function! ale#c#FindProjectRoot(buffer) abort
|
|||
let l:path = fnamemodify(l:full_path, ':h')
|
||||
|
||||
" Correct .git path detection.
|
||||
if fnamemodify(l:path, ':t') ==# '.git'
|
||||
if fnamemodify(l:path, ':t') is# '.git'
|
||||
let l:path = fnamemodify(l:path, ':h')
|
||||
endif
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort
|
|||
" foo.
|
||||
" ^
|
||||
" We need to include all of the given suggestions.
|
||||
if a:prefix ==# '.'
|
||||
if a:prefix is# '.'
|
||||
return a:suggestions
|
||||
endif
|
||||
|
||||
|
@ -59,7 +59,7 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort
|
|||
for l:suggestion in a:suggestions
|
||||
" Add suggestions if the suggestion starts with a case-insensitive
|
||||
" match for the prefix.
|
||||
if l:suggestion.word[: len(a:prefix) - 1] ==? a:prefix
|
||||
if l:suggestion.word[: len(a:prefix) - 1] is? a:prefix
|
||||
call add(l:filtered_suggestions, l:suggestion)
|
||||
endif
|
||||
endfor
|
||||
|
@ -150,9 +150,9 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
|||
call add(l:documentationParts, l:part.text)
|
||||
endfor
|
||||
|
||||
if l:suggestion.kind ==# 'clasName'
|
||||
if l:suggestion.kind is# 'clasName'
|
||||
let l:kind = 'f'
|
||||
elseif l:suggestion.kind ==# 'parameterName'
|
||||
elseif l:suggestion.kind is# 'parameterName'
|
||||
let l:kind = 'f'
|
||||
else
|
||||
let l:kind = 'v'
|
||||
|
@ -182,7 +182,7 @@ function! s:HandleTSServerLSPResponse(conn_id, response) abort
|
|||
|
||||
let l:command = get(a:response, 'command', '')
|
||||
|
||||
if l:command ==# 'completions'
|
||||
if l:command is# 'completions'
|
||||
let l:names = ale#completion#ParseTSServerCompletions(a:response)
|
||||
|
||||
if !empty(l:names)
|
||||
|
@ -196,7 +196,7 @@ function! s:HandleTSServerLSPResponse(conn_id, response) abort
|
|||
\ ),
|
||||
\)
|
||||
endif
|
||||
elseif l:command ==# 'completionEntryDetails'
|
||||
elseif l:command is# 'completionEntryDetails'
|
||||
call ale#completion#Show(
|
||||
\ a:response,
|
||||
\ 'ale#completion#ParseTSServerCompletionEntryDetails',
|
||||
|
@ -256,7 +256,7 @@ function! ale#completion#GetCompletions() abort
|
|||
\}
|
||||
|
||||
for l:linter in ale#linter#Get(&filetype)
|
||||
if l:linter.lsp ==# 'tsserver'
|
||||
if l:linter.lsp is# 'tsserver'
|
||||
call s:GetLSPCompletions(l:linter)
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
" Return a formatted message according to g:ale_echo_msg_format variable
|
||||
function! s:GetMessage(linter, type, text) abort
|
||||
let l:msg = g:ale_echo_msg_format
|
||||
let l:type = a:type ==# 'E'
|
||||
let l:type = a:type is# 'E'
|
||||
\ ? g:ale_echo_msg_error_str
|
||||
\ : g:ale_echo_msg_warning_str
|
||||
|
||||
|
@ -22,12 +22,12 @@ function! s:EchoWithShortMess(setting, message) abort
|
|||
|
||||
try
|
||||
" Turn shortmess on or off.
|
||||
if a:setting ==# 'on'
|
||||
if a:setting is# 'on'
|
||||
setlocal shortmess+=T
|
||||
" echomsg is needed for the message to get truncated and appear in
|
||||
" the message history.
|
||||
exec "norm! :echomsg a:message\n"
|
||||
elseif a:setting ==# 'off'
|
||||
elseif a:setting is# 'off'
|
||||
setlocal shortmess-=T
|
||||
" Regular echo is needed for printing newline characters.
|
||||
echo a:message
|
||||
|
|
|
@ -81,7 +81,7 @@ function! s:EchoCommandHistory() abort
|
|||
let l:status_message = l:item.status
|
||||
|
||||
" Include the exit code in output if we have it.
|
||||
if l:item.status ==# 'finished'
|
||||
if l:item.status is# 'finished'
|
||||
let l:status_message .= ' - exit code ' . l:item.exit_code
|
||||
endif
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
|||
" tsserver sends syntax and semantic errors in separate messages, so we
|
||||
" have to collect the messages separately for each buffer and join them
|
||||
" back together again.
|
||||
if a:error_type ==# 'syntax'
|
||||
if a:error_type is# 'syntax'
|
||||
let l:info.syntax_loclist = l:thislist
|
||||
else
|
||||
let l:info.semantic_loclist = l:thislist
|
||||
|
@ -247,16 +247,16 @@ endfunction
|
|||
function! ale#engine#HandleLSPResponse(conn_id, response) abort
|
||||
let l:method = get(a:response, 'method', '')
|
||||
|
||||
if get(a:response, 'jsonrpc', '') ==# '2.0' && has_key(a:response, 'error')
|
||||
if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error')
|
||||
" Uncomment this line to print LSP error messages.
|
||||
" call s:HandleLSPErrorMessage(a:response.error.message)
|
||||
elseif l:method ==# 'textDocument/publishDiagnostics'
|
||||
elseif l:method is# 'textDocument/publishDiagnostics'
|
||||
call s:HandleLSPDiagnostics(a:conn_id, a:response)
|
||||
elseif get(a:response, 'type', '') ==# 'event'
|
||||
\&& get(a:response, 'event', '') ==# 'semanticDiag'
|
||||
elseif get(a:response, 'type', '') is# 'event'
|
||||
\&& get(a:response, 'event', '') is# 'semanticDiag'
|
||||
call s:HandleTSServerDiagnostics(a:response, 'semantic')
|
||||
elseif get(a:response, 'type', '') ==# 'event'
|
||||
\&& get(a:response, 'event', '') ==# 'syntaxDiag'
|
||||
elseif get(a:response, 'type', '') is# 'event'
|
||||
\&& get(a:response, 'event', '') is# 'syntaxDiag'
|
||||
call s:HandleTSServerDiagnostics(a:response, 'syntax')
|
||||
endif
|
||||
endfunction
|
||||
|
@ -313,17 +313,17 @@ endfunction
|
|||
function! s:RemapItemTypes(type_map, loclist) abort
|
||||
for l:item in a:loclist
|
||||
let l:key = l:item.type
|
||||
\ . (get(l:item, 'sub_type', '') ==# 'style' ? 'S' : '')
|
||||
\ . (get(l:item, 'sub_type', '') is# 'style' ? 'S' : '')
|
||||
let l:new_key = get(a:type_map, l:key, '')
|
||||
|
||||
if l:new_key ==# 'E'
|
||||
\|| l:new_key ==# 'ES'
|
||||
\|| l:new_key ==# 'W'
|
||||
\|| l:new_key ==# 'WS'
|
||||
\|| l:new_key ==# 'I'
|
||||
if l:new_key is# 'E'
|
||||
\|| l:new_key is# 'ES'
|
||||
\|| l:new_key is# 'W'
|
||||
\|| l:new_key is# 'WS'
|
||||
\|| l:new_key is# 'I'
|
||||
let l:item.type = l:new_key[0]
|
||||
|
||||
if l:new_key ==# 'ES' || l:new_key ==# 'WS'
|
||||
if l:new_key is# 'ES' || l:new_key is# 'WS'
|
||||
let l:item.sub_type = 'style'
|
||||
elseif has_key(l:item, 'sub_type')
|
||||
call remove(l:item, 'sub_type')
|
||||
|
@ -465,9 +465,9 @@ function! s:RunJob(options) abort
|
|||
\ 'exit_cb': function('s:HandleExit'),
|
||||
\}
|
||||
|
||||
if l:output_stream ==# 'stderr'
|
||||
if l:output_stream is# 'stderr'
|
||||
let l:job_options.err_cb = function('s:GatherOutput')
|
||||
elseif l:output_stream ==# 'both'
|
||||
elseif l:output_stream is# 'both'
|
||||
let l:job_options.out_cb = function('s:GatherOutput')
|
||||
let l:job_options.err_cb = function('s:GatherOutput')
|
||||
else
|
||||
|
@ -635,7 +635,7 @@ function! s:CheckWithLSP(buffer, linter) abort
|
|||
" Remember the linter this connection is for.
|
||||
let s:lsp_linter_map[l:id] = a:linter.name
|
||||
|
||||
let l:change_message = a:linter.lsp ==# 'tsserver'
|
||||
let l:change_message = a:linter.lsp is# 'tsserver'
|
||||
\ ? ale#lsp#tsserver_message#Geterr(a:buffer)
|
||||
\ : ale#lsp#message#DidChange(a:buffer)
|
||||
let l:request_id = ale#lsp#Send(l:id, l:change_message, l:root)
|
||||
|
|
|
@ -186,9 +186,9 @@ function! s:RunJob(options) abort
|
|||
if l:read_temporary_file
|
||||
" TODO: Check that a temporary file is set here.
|
||||
let l:job_info.file_to_read = l:temporary_file
|
||||
elseif l:output_stream ==# 'stderr'
|
||||
elseif l:output_stream is# 'stderr'
|
||||
let l:job_options.err_cb = function('s:GatherOutput')
|
||||
elseif l:output_stream ==# 'both'
|
||||
elseif l:output_stream is# 'both'
|
||||
let l:job_options.out_cb = function('s:GatherOutput')
|
||||
let l:job_options.err_cb = function('s:GatherOutput')
|
||||
else
|
||||
|
@ -320,7 +320,7 @@ function! ale#fix#InitBufferData(buffer, fixing_flag) abort
|
|||
\ 'lines_before': getbufline(a:buffer, 1, '$'),
|
||||
\ 'filename': expand('#' . a:buffer . ':p'),
|
||||
\ 'done': 0,
|
||||
\ 'should_save': a:fixing_flag ==# 'save_file',
|
||||
\ 'should_save': a:fixing_flag is# 'save_file',
|
||||
\ 'temporary_directory_list': [],
|
||||
\}
|
||||
endfunction
|
||||
|
@ -342,7 +342,7 @@ function! ale#fix#Fix(...) abort
|
|||
let l:callback_list = s:GetCallbacks()
|
||||
|
||||
if empty(l:callback_list)
|
||||
if l:fixing_flag ==# ''
|
||||
if l:fixing_flag is# ''
|
||||
echoerr 'No fixers have been defined. Try :ALEFixSuggest'
|
||||
endif
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
|
|||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endif
|
||||
|
|
|
@ -29,7 +29,7 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
|
|||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'type': l:type is# 'Warning' ? 'W' : 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
@ -61,7 +61,7 @@ function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
|
|||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:match[3] ==# '✖' ? 'E' : 'W',
|
||||
\ 'type': l:match[3] is# '✖' ? 'E' : 'W',
|
||||
\ 'text': l:match[4] . ' [' . l:match[5] . ']',
|
||||
\})
|
||||
endfor
|
||||
|
|
|
@ -92,7 +92,7 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort
|
|||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'type': l:type is# 'Warning' ? 'W' : 'E',
|
||||
\}
|
||||
|
||||
for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns)
|
||||
|
|
|
@ -81,7 +81,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
|||
let l:included_filename = ''
|
||||
endif
|
||||
elseif l:include_lnum > 0
|
||||
\&& (empty(l:included_filename) || l:included_filename ==# l:match[1])
|
||||
\&& (empty(l:included_filename) || l:included_filename is# l:match[1])
|
||||
" If we hit the first error after an include header, or the
|
||||
" errors below have the same name as the first filename we see,
|
||||
" then include these lines, and remember what that filename was.
|
||||
|
@ -96,7 +96,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
|||
let l:included_filename = ''
|
||||
|
||||
if s:IsHeaderFile(bufname(bufnr('')))
|
||||
\&& l:match[5][:len(s:pragma_error) - 1] ==# s:pragma_error
|
||||
\&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error
|
||||
continue
|
||||
endif
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||
for l:line in a:lines
|
||||
if len(matchlist(l:line, l:pattern)) > 0
|
||||
call add(l:corrected_lines, l:line)
|
||||
elseif l:line ==# ''
|
||||
elseif l:line is# ''
|
||||
call add(l:corrected_lines, l:line)
|
||||
else
|
||||
if len(l:corrected_lines) > 0
|
||||
|
@ -42,10 +42,10 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||
let l:text = l:errors[2]
|
||||
else
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[4][:0] ==# ' ' ? l:match[4][1:] : l:match[4]
|
||||
let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4]
|
||||
endif
|
||||
|
||||
if l:ghc_type ==? 'Warning'
|
||||
if l:ghc_type is? 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
|
|
|
@ -47,7 +47,7 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
|
|||
for l:span in l:error.spans
|
||||
if (
|
||||
\ l:span.is_primary
|
||||
\ && (ale#path#IsBufferPath(a:buffer, l:span.file_name) || l:span.file_name ==# '<anon>')
|
||||
\ && (ale#path#IsBufferPath(a:buffer, l:span.file_name) || l:span.file_name is# '<anon>')
|
||||
\)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:span.line_start,
|
||||
|
|
|
@ -65,15 +65,15 @@ function! ale#highlight#UpdateHighlights() abort
|
|||
call ale#highlight#RemoveHighlights()
|
||||
|
||||
for l:item in l:item_list
|
||||
if l:item.type ==# 'W'
|
||||
if get(l:item, 'sub_type', '') ==# 'style'
|
||||
if l:item.type is# 'W'
|
||||
if get(l:item, 'sub_type', '') is# 'style'
|
||||
let l:group = 'ALEStyleWarning'
|
||||
else
|
||||
let l:group = 'ALEWarning'
|
||||
endif
|
||||
elseif l:item.type ==# 'I'
|
||||
elseif l:item.type is# 'I'
|
||||
let l:group = 'ALEInfo'
|
||||
elseif get(l:item, 'sub_type', '') ==# 'style'
|
||||
elseif get(l:item, 'sub_type', '') is# 'style'
|
||||
let l:group = 'ALEStyleError'
|
||||
else
|
||||
let l:group = 'ALEError'
|
||||
|
|
|
@ -34,7 +34,7 @@ function! ale#job#JoinNeovimOutput(job, last_line, data, mode, callback) abort
|
|||
let l:new_last_line = a:last_line . a:data[0]
|
||||
endif
|
||||
|
||||
if a:mode ==# 'raw'
|
||||
if a:mode is# 'raw'
|
||||
if !empty(l:lines)
|
||||
call a:callback(a:job, join(l:lines, "\n") . "\n")
|
||||
endif
|
||||
|
@ -50,7 +50,7 @@ endfunction
|
|||
function! s:NeoVimCallback(job, data, event) abort
|
||||
let l:info = s:job_map[a:job]
|
||||
|
||||
if a:event ==# 'stdout'
|
||||
if a:event is# 'stdout'
|
||||
let l:info.out_cb_line = ale#job#JoinNeovimOutput(
|
||||
\ a:job,
|
||||
\ l:info.out_cb_line,
|
||||
|
@ -58,7 +58,7 @@ function! s:NeoVimCallback(job, data, event) abort
|
|||
\ l:info.mode,
|
||||
\ ale#util#GetFunction(l:info.out_cb),
|
||||
\)
|
||||
elseif a:event ==# 'stderr'
|
||||
elseif a:event is# 'stderr'
|
||||
let l:info.err_cb_line = ale#job#JoinNeovimOutput(
|
||||
\ a:job,
|
||||
\ l:info.err_cb_line,
|
||||
|
@ -117,7 +117,7 @@ function! s:VimCloseCallback(channel) abort
|
|||
|
||||
" job_status() can trigger the exit handler.
|
||||
" The channel can close before the job has exited.
|
||||
if job_status(l:job) ==# 'dead'
|
||||
if job_status(l:job) is# 'dead'
|
||||
try
|
||||
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
||||
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, l:info.exit_code)
|
||||
|
@ -142,7 +142,7 @@ function! s:VimExitCallback(job, exit_code) abort
|
|||
let l:info.exit_code = a:exit_code
|
||||
|
||||
" The program can exit before the data has finished being read.
|
||||
if ch_status(job_getchannel(a:job)) ==# 'closed'
|
||||
if ch_status(job_getchannel(a:job)) is# 'closed'
|
||||
try
|
||||
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
||||
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, a:exit_code)
|
||||
|
@ -273,7 +273,7 @@ function! ale#job#IsRunning(job_id) abort
|
|||
endtry
|
||||
elseif has_key(s:job_map, a:job_id)
|
||||
let l:job = s:job_map[a:job_id].job
|
||||
return job_status(l:job) ==# 'run'
|
||||
return job_status(l:job) is# 'run'
|
||||
endif
|
||||
|
||||
return 0
|
||||
|
@ -296,7 +296,7 @@ function! ale#job#Stop(job_id) abort
|
|||
|
||||
" We must close the channel for reading the buffer if it is open
|
||||
" when stopping a job. Otherwise, we will get errors in the status line.
|
||||
if ch_status(job_getchannel(l:job)) ==# 'open'
|
||||
if ch_status(job_getchannel(l:job)) is# 'open'
|
||||
call ch_close_in(job_getchannel(l:job))
|
||||
endif
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ function! ale#linter#PreProcess(linter) abort
|
|||
throw '`name` must be defined to name the linter'
|
||||
endif
|
||||
|
||||
let l:needs_address = l:obj.lsp ==# 'socket'
|
||||
let l:needs_address = l:obj.lsp is# 'socket'
|
||||
let l:needs_executable = l:obj.lsp !=# 'socket'
|
||||
let l:needs_command = l:obj.lsp !=# 'socket'
|
||||
let l:needs_lsp_details = !empty(l:obj.lsp)
|
||||
|
@ -311,7 +311,7 @@ function! ale#linter#Get(original_filetypes) abort
|
|||
let l:all_linters = ale#linter#GetAll(l:filetype)
|
||||
let l:filetype_linters = []
|
||||
|
||||
if type(l:linter_names) == type('') && l:linter_names ==# 'all'
|
||||
if type(l:linter_names) == type('') && l:linter_names is# 'all'
|
||||
let l:filetype_linters = l:all_linters
|
||||
elseif type(l:linter_names) == type([])
|
||||
" Select only the linters we or the user has specified.
|
||||
|
@ -383,7 +383,7 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort
|
|||
return {}
|
||||
endif
|
||||
|
||||
if a:linter.lsp ==# 'socket'
|
||||
if a:linter.lsp is# 'socket'
|
||||
let l:address = ale#linter#GetAddress(a:buffer, a:linter)
|
||||
let l:conn_id = ale#lsp#ConnectToAddress(
|
||||
\ l:address,
|
||||
|
@ -425,7 +425,7 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort
|
|||
endif
|
||||
|
||||
" The change message needs to be sent for tsserver before doing anything.
|
||||
if a:linter.lsp ==# 'tsserver'
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
call ale#lsp#Send(l:conn_id, ale#lsp#tsserver_message#Change(a:buffer))
|
||||
endif
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
" Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list
|
||||
function! ale#list#IsQuickfixOpen() abort
|
||||
for l:buf in range(1, bufnr('$'))
|
||||
if getbufvar(l:buf, '&buftype') ==# 'quickfix'
|
||||
if getbufvar(l:buf, '&buftype') is# 'quickfix'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
@ -18,7 +18,7 @@ function! s:ShouldOpen(buffer) abort
|
|||
let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0)
|
||||
|
||||
return (type(l:val) == type(1) && l:val == 1)
|
||||
\ || (type(l:val) == type('') && l:val ==# 'on_save' && l:saved)
|
||||
\ || (type(l:val) == type('') && l:val is# 'on_save' && l:saved)
|
||||
endfunction
|
||||
|
||||
function! ale#list#SetLists(buffer, loclist) abort
|
||||
|
@ -51,8 +51,8 @@ function! ale#list#SetLists(buffer, loclist) abort
|
|||
if s:ShouldOpen(a:buffer) && (l:keep_open || !empty(a:loclist))
|
||||
let l:winnr = winnr()
|
||||
let l:mode = mode()
|
||||
let l:reset_visual_selection = l:mode ==? 'v' || l:mode ==# "\<c-v>"
|
||||
let l:reset_character_selection = l:mode ==? 's' || l:mode ==# "\<c-s>"
|
||||
let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\<c-v>"
|
||||
let l:reset_character_selection = l:mode is? 's' || l:mode is# "\<c-s>"
|
||||
|
||||
if g:ale_set_quickfix
|
||||
if !ale#list#IsQuickfixOpen()
|
||||
|
|
|
@ -17,7 +17,7 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort
|
|||
let l:search_item = {'lnum': l:pos[1], 'col': l:pos[2]}
|
||||
|
||||
" When searching backwards, so we can find the next smallest match.
|
||||
if a:direction ==# 'before'
|
||||
if a:direction is# 'before'
|
||||
let l:loclist = reverse(copy(l:loclist))
|
||||
endif
|
||||
|
||||
|
@ -36,11 +36,11 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort
|
|||
\ l:search_item
|
||||
\)
|
||||
|
||||
if a:direction ==# 'before' && l:cmp_value < 0
|
||||
if a:direction is# 'before' && l:cmp_value < 0
|
||||
return [l:item.lnum, l:item.col]
|
||||
endif
|
||||
|
||||
if a:direction ==# 'after' && l:cmp_value > 0
|
||||
if a:direction is# 'after' && l:cmp_value > 0
|
||||
return [l:item.lnum, l:item.col]
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -190,17 +190,17 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
|
|||
return
|
||||
endif
|
||||
|
||||
if get(a:response, 'method', '') ==# ''
|
||||
if get(a:response, 'method', '') is# ''
|
||||
if has_key(get(a:response, 'result', {}), 'capabilities')
|
||||
for [l:dir, l:project] in l:uninitialized_projects
|
||||
call s:MarkProjectAsInitialized(a:conn, l:project)
|
||||
endfor
|
||||
endif
|
||||
elseif get(a:response, 'method', '') ==# 'textDocument/publishDiagnostics'
|
||||
elseif get(a:response, 'method', '') is# 'textDocument/publishDiagnostics'
|
||||
let l:filename = ale#path#FromURI(a:response.params.uri)
|
||||
|
||||
for [l:dir, l:project] in l:uninitialized_projects
|
||||
if l:filename[:len(l:dir) - 1] ==# l:dir
|
||||
if l:filename[:len(l:dir) - 1] is# l:dir
|
||||
call s:MarkProjectAsInitialized(a:conn, l:project)
|
||||
endif
|
||||
endfor
|
||||
|
@ -215,7 +215,7 @@ function! ale#lsp#HandleMessage(conn, message) abort
|
|||
|
||||
" Call our callbacks.
|
||||
for l:response in l:response_list
|
||||
if get(l:response, 'method', '') ==# 'initialize'
|
||||
if get(l:response, 'method', '') is# 'initialize'
|
||||
call s:HandleInitializeResponse(a:conn, l:response)
|
||||
else
|
||||
call ale#lsp#HandleOtherInitializeResponses(a:conn, l:response)
|
||||
|
@ -304,7 +304,7 @@ function! ale#lsp#ConnectToAddress(address, project_root, callback) abort
|
|||
\})
|
||||
endif
|
||||
|
||||
if ch_status(l:conn.channnel) ==# 'fail'
|
||||
if ch_status(l:conn.channnel) is# 'fail'
|
||||
return 0
|
||||
endif
|
||||
|
||||
|
@ -319,7 +319,7 @@ endfunction
|
|||
function! s:SendMessageData(conn, data) abort
|
||||
if has_key(a:conn, 'executable')
|
||||
call ale#job#SendRaw(a:conn.id, a:data)
|
||||
elseif has_key(a:conn, 'channel') && ch_status(a:conn.channnel) ==# 'open'
|
||||
elseif has_key(a:conn, 'channel') && ch_status(a:conn.channnel) is# 'open'
|
||||
" Send the message to the server
|
||||
call ch_sendraw(a:conn.channel, a:data)
|
||||
else
|
||||
|
|
|
@ -65,7 +65,7 @@ endfunction
|
|||
" Return 1 if a path is an absolute path.
|
||||
function! ale#path#IsAbsolute(filename) abort
|
||||
" Check for /foo and C:\foo, etc.
|
||||
return a:filename[:0] ==# '/' || a:filename[1:2] ==# ':\'
|
||||
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
|
||||
endfunction
|
||||
|
||||
" Given a filename, return 1 if the file represents some temporary file
|
||||
|
@ -78,7 +78,7 @@ function! ale#path#IsTempName(filename) abort
|
|||
\]
|
||||
|
||||
for l:prefix in l:prefix_list
|
||||
if a:filename[:len(l:prefix) - 1] ==# l:prefix
|
||||
if a:filename[:len(l:prefix) - 1] is# l:prefix
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
@ -90,19 +90,19 @@ endfunction
|
|||
" two paths represent the same file on disk.
|
||||
function! ale#path#IsBufferPath(buffer, complex_filename) abort
|
||||
" If the path is one of many different names for stdin, we have a match.
|
||||
if a:complex_filename ==# '-'
|
||||
\|| a:complex_filename ==# 'stdin'
|
||||
\|| a:complex_filename[:0] ==# '<'
|
||||
if a:complex_filename is# '-'
|
||||
\|| a:complex_filename is# 'stdin'
|
||||
\|| a:complex_filename[:0] is# '<'
|
||||
return 1
|
||||
endif
|
||||
|
||||
let l:test_filename = ale#path#Simplify(a:complex_filename)
|
||||
|
||||
if l:test_filename[:1] ==# './'
|
||||
if l:test_filename[:1] is# './'
|
||||
let l:test_filename = l:test_filename[2:]
|
||||
endif
|
||||
|
||||
if l:test_filename[:1] ==# '..'
|
||||
if l:test_filename[:1] is# '..'
|
||||
" Remove ../../ etc. from the front of the path.
|
||||
let l:test_filename = substitute(l:test_filename, '\v^(\.\.[/\\])+', '/', '')
|
||||
endif
|
||||
|
@ -114,8 +114,8 @@ function! ale#path#IsBufferPath(buffer, complex_filename) abort
|
|||
|
||||
let l:buffer_filename = expand('#' . a:buffer . ':p')
|
||||
|
||||
return l:buffer_filename ==# l:test_filename
|
||||
\ || l:buffer_filename[-len(l:test_filename):] ==# l:test_filename
|
||||
return l:buffer_filename is# l:test_filename
|
||||
\ || l:buffer_filename[-len(l:test_filename):] is# l:test_filename
|
||||
endfunction
|
||||
|
||||
" Given a path, return every component of the path, moving upwards.
|
||||
|
@ -133,7 +133,7 @@ function! ale#path#Upwards(path) abort
|
|||
if ale#Has('win32') && a:path =~# '^[a-zA-z]:\'
|
||||
" Add \ to C: for C:\, etc.
|
||||
let l:path_list[-1] .= '\'
|
||||
elseif a:path[0] ==# '/'
|
||||
elseif a:path[0] is# '/'
|
||||
" If the path starts with /, even on Windows, add / and / to all paths.
|
||||
call map(l:path_list, '''/'' . v:val')
|
||||
call add(l:path_list, '/')
|
||||
|
@ -146,10 +146,10 @@ endfunction
|
|||
" relatives paths will not be prefixed with the protocol.
|
||||
" For Windows paths, the `:` in C:\ etc. will not be percent-encoded.
|
||||
function! ale#path#ToURI(path) abort
|
||||
let l:has_drive_letter = a:path[1:2] ==# ':\'
|
||||
let l:has_drive_letter = a:path[1:2] is# ':\'
|
||||
|
||||
return substitute(
|
||||
\ ((l:has_drive_letter || a:path[:0] ==# '/') ? 'file://' : '')
|
||||
\ ((l:has_drive_letter || a:path[:0] is# '/') ? 'file://' : '')
|
||||
\ . (l:has_drive_letter ? '/' . a:path[:2] : '')
|
||||
\ . ale#uri#Encode(l:has_drive_letter ? a:path[3:] : a:path),
|
||||
\ '\\',
|
||||
|
@ -160,7 +160,7 @@ endfunction
|
|||
|
||||
function! ale#path#FromURI(uri) abort
|
||||
let l:i = len('file://')
|
||||
let l:encoded_path = a:uri[: l:i - 1] ==# 'file://' ? a:uri[l:i :] : a:uri
|
||||
let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri
|
||||
|
||||
return ale#uri#Decode(l:encoded_path)
|
||||
endfunction
|
||||
|
|
|
@ -13,7 +13,7 @@ function! ale#pattern_options#SetOptions() abort
|
|||
endfor
|
||||
|
||||
for l:key in keys(l:options)
|
||||
if l:key[:0] ==# '&'
|
||||
if l:key[:0] is# '&'
|
||||
call setbufvar(bufnr(''), l:key, l:options[l:key])
|
||||
else
|
||||
let b:[l:key] = l:options[l:key]
|
||||
|
|
|
@ -168,9 +168,9 @@ function! ale#sign#GetSignType(sublist) abort
|
|||
let l:highest_level = 100
|
||||
|
||||
for l:item in a:sublist
|
||||
let l:level = (l:item.type ==# 'I' ? 2 : l:item.type ==# 'W')
|
||||
let l:level = (l:item.type is# 'I' ? 2 : l:item.type is# 'W')
|
||||
|
||||
if get(l:item, 'sub_type', '') ==# 'style'
|
||||
if get(l:item, 'sub_type', '') is# 'style'
|
||||
let l:level += 10
|
||||
endif
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ function! ale#statusline#Update(buffer, loclist) abort
|
|||
let l:count.total = len(a:loclist)
|
||||
|
||||
for l:entry in a:loclist
|
||||
if l:entry.type ==# 'W'
|
||||
if get(l:entry, 'sub_type', '') ==# 'style'
|
||||
if l:entry.type is# 'W'
|
||||
if get(l:entry, 'sub_type', '') is# 'style'
|
||||
let l:count.style_warning += 1
|
||||
else
|
||||
let l:count.warning += 1
|
||||
endif
|
||||
elseif l:entry.type ==# 'I'
|
||||
elseif l:entry.type is# 'I'
|
||||
let l:count.info += 1
|
||||
elseif get(l:entry, 'sub_type', '') ==# 'style'
|
||||
elseif get(l:entry, 'sub_type', '') is# 'style'
|
||||
let l:count.style_error += 1
|
||||
else
|
||||
let l:count.error += 1
|
||||
|
|
|
@ -193,7 +193,7 @@ endfunction
|
|||
" The buffer number is required for determining the fileformat setting for
|
||||
" the buffer.
|
||||
function! ale#util#Writefile(buffer, lines, filename) abort
|
||||
let l:corrected_lines = getbufvar(a:buffer, '&fileformat') ==# 'dos'
|
||||
let l:corrected_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
|
||||
\ ? map(copy(a:lines), 'v:val . "\r"')
|
||||
\ : a:lines
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue