diff options
-rw-r--r-- | runtime/autoload/dist/ft.vim | 2 | ||||
-rw-r--r-- | runtime/filetype.vim | 10 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 8 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 1 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 1 | ||||
-rw-r--r-- | src/nvim/eval/vars.c | 4 | ||||
-rw-r--r-- | src/nvim/option.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 26 | ||||
-rw-r--r-- | test/functional/vimscript/buf_functions_spec.lua | 4 |
10 files changed, 55 insertions, 11 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 9e30ae1f51..a2f485dd67 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -519,7 +519,7 @@ func dist#ft#FTinc() " headers so assume POV-Ray elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords setf pascal - elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = ' + elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '[A-Z][A-Za-z0-9_:${}]*\s\+\%(??\|[?:+]\)\?= ' setf bitbake else call dist#ft#FTasmsyntax() diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5a5937a209..fbb4b9f6aa 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -860,9 +860,13 @@ au BufNewFile,BufRead *.hb setf hb " Httest au BufNewFile,BufRead *.htt,*.htb setf httest -" i3 (and sway) -au BufNewFile,BufRead */i3/config,*/sway/config setf i3config -au BufNewFile,BufRead */.i3/config,*/.sway/config setf i3config +" i3 +au BufNewFile,BufRead */i3/config setf i3config +au BufNewFile,BufRead */.i3/config setf i3config + +" sway +au BufNewFile,BufRead */sway/config setf swayconfig +au BufNewFile,BufRead */.sway/config setf swayconfig " Icon au BufNewFile,BufRead *.icn setf icon diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 10eff6598c..9c59442caf 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1384,10 +1384,6 @@ local filename = { ['/etc/host.conf'] = 'hostconf', ['/etc/hosts.allow'] = 'hostsaccess', ['/etc/hosts.deny'] = 'hostsaccess', - ['/i3/config'] = 'i3config', - ['/sway/config'] = 'i3config', - ['/.sway/config'] = 'i3config', - ['/.i3/config'] = 'i3config', ['/.icewm/menu'] = 'icemenu', ['.indent.pro'] = 'indent', indentrc = 'indent', @@ -1835,9 +1831,7 @@ local pattern = { ['.*/etc/hosts%.allow'] = 'hostsaccess', ['.*%.html%.m4'] = 'htmlm4', ['.*/%.i3/config'] = 'i3config', - ['.*/sway/config'] = 'i3config', ['.*/i3/config'] = 'i3config', - ['.*/%.sway/config'] = 'i3config', ['.*/%.icewm/menu'] = 'icemenu', ['.*/etc/initng/.*/.*%.i'] = 'initng', ['JAM.*%..*'] = starsetf('jam'), @@ -2076,6 +2070,8 @@ local pattern = { end, ['.*/etc/sudoers'] = 'sudoers', ['svn%-commit.*%.tmp'] = 'svn', + ['.*/sway/config'] = 'swayconfig', + ['.*/%.sway/config'] = 'swayconfig', ['.*%.swift%.gyb'] = 'swiftgyb', ['.*%.[Ss][Yy][Ss]'] = function(path, bufnr) return require('vim.filetype.detect').sys(bufnr) diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 8c10517687..14f076717f 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -554,7 +554,7 @@ function M.inc(bufnr) -- headers so assume POV-Ray elseif findany(lines, { '^%s{', '^%s%(%*' }) or matchregex(lines, pascal_keywords) then return 'pascal' - elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%w+%s+= ' }) then + elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%u[%w_:${}]*%s+%??[?:+]?= ' }) then return 'bitbake' else local syntax = M.asm_syntax(bufnr) diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index cfc35f0b51..1e6ac8dddf 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -257,6 +257,7 @@ end) --see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename M['textDocument/rename'] = function(_, result, ctx, _) if not result then + vim.notify("Language server couldn't provide rename result", vim.log.levels.INFO) return end local client = vim.lsp.get_client_by_id(ctx.client_id) diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 6ecb9959d5..27da60b4ae 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -759,6 +759,7 @@ function protocol.make_client_capabilities() }, hierarchicalWorkspaceSymbolSupport = true, }, + configuration = true, workspaceFolders = true, applyEdit = true, workspaceEdit = { diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 190cc62d85..1aecb40e0b 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1617,6 +1617,10 @@ static void set_option_from_tv(const char *varname, typval_T *varp) char nbuf[NUMBUFLEN]; if (varp->v_type == VAR_BOOL) { + if (is_string_option(varname)) { + emsg(_(e_stringreq)); + return; + } numval = (long)varp->vval.v_number; strval = "0"; // avoid using "false" } else { diff --git a/src/nvim/option.c b/src/nvim/option.c index ea4c7080b7..7edc2e55f5 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5301,6 +5301,14 @@ char *set_option_value(const char *const name, const long number, const char *co return NULL; } +/// Return true if "name" is a string option. +/// Returns false if option "name" does not exist. +bool is_string_option(const char *name) +{ + int idx = findoption(name); + return idx >= 0 && (options[idx].flags & P_STRING); +} + // Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number. // When "has_lt" is true there is a '<' before "*arg_arg". // Returns 0 when the key is not recognized. diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 53f8d4f3ef..eedad15e9e 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -534,6 +534,7 @@ let s:filename_checks = { \ 'svelte': ['file.svelte'], \ 'svg': ['file.svg'], \ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'], + \ 'swayconfig': ['/home/user/.sway/config', '/home/user/.config/sway/config', '/etc/sway/config', '/etc/xdg/sway/config'], \ 'swift': ['file.swift'], \ 'swiftgyb': ['file.swift.gyb'], \ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'], @@ -1861,6 +1862,31 @@ func Test_inc_file() call assert_equal('bitbake', &filetype) bwipe! + call writefile(['S = "${WORKDIR}"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['DEPENDS:append = " somedep"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['MACHINE ??= "qemu"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['PROVIDES := "test"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['RDEPENDS_${PN} += "bar"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + " asm call writefile(['asmsyntax=bar'], 'Xfile.inc') split Xfile.inc diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index e957e5f5af..b521620320 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -303,4 +303,8 @@ describe('setbufvar() function', function() pcall_err(funcs.setbufvar, 1, 'changedtick', true)) eq(2, funcs.getbufvar(1, 'changedtick')) end) + it('throws error when setting a string option to a boolean value vim-patch:9.0.0090', function() + eq('Vim:E928: String required', + pcall_err(funcs.setbufvar, '', '&errorformat', true)) + end) end) |