Commit Graph

1333 Commits

Author SHA1 Message Date
Lewis Russell
a289e82142
fix(treesitter): make params optional 2023-02-15 12:26:07 +00:00
Justin M. Keyes
1539f71363
Merge #22214 move init_default_autocmds to lua 2023-02-14 19:13:12 -05:00
Jonas Strittmatter
b518aceaa8
feat(filetype): fall back to file extension when matching from hashbang (#22140)
If nothing matched in match_from_hashbang, also check the file extension table.
For a hashbang like '#!/bin/env foo', this will set the filetype to 'fooscript'
assuming the filetype for the 'foo' extension is 'fooscript' in the extension
table.
2023-02-13 16:04:16 -07:00
Lewis Russell
d359f7a533
Merge pull request #22191 from lewis6991/feat/playground_imp
feat(treesitter): playground improvements
2023-02-13 10:54:03 +00:00
Jonas Strittmatter
9668c166e8
fix(filetype): make vim.filetype.match() work with contents only (#22181)
Co-authored-by: Gregory Anders <greg@gpanders.com>
2023-02-11 08:08:33 -07:00
glacambre
c5b34fa554 refactor: move init_default_autocmds to lua
The original motivation for this change came from developping
https://github.com/neovim/neovim/pull/22159, which will require adding
more autocommand creation to Neovim's startup sequence.

This change requires lightly editing a test that expected no autocommand
to have been created from lua.
2023-02-11 14:02:17 +01:00
Lewis Russell
8a985d12dd fix(treesitter): don't trample parsers when filetype!=lang
This allows vim.treesitter.show_tree() to work on buffers where the
filetype does not match the parser language name e.g, bash/sh.
2023-02-10 16:15:56 +00:00
Lewis Russell
f5bad01869 feat(treesitter): playground improvements
- Render node ranges as virtual text
- Set filettype=query. The virtual text is to avoid parsing errors.
- Make sure highlights text is always in view.
2023-02-10 16:15:55 +00:00
Christian Clason
1ca4a8b1dd
vim-patch:9.0.1291: Move language files are not recognized (#22162)
Problem:    Move language files are not recognized.
Solution:   Recognize Move language files. (Amaan Qureshi, closes vim/vim#11947)

6642982bea

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-02-08 09:47:55 +01:00
Christian Clason
8fbe75b3dd
vim-patch:9.0.1288: FunC files are not recognized (#22153)
Problem:    FunC files are not recognized.
Solution:   Recognize FunC files. (Amaan Qureshi, closes vim/vim#11949)

91deac4539

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-02-07 10:29:37 +01:00
Amaan Qureshi
1675f0e270
vim-patch:9.0.1282: Ron files are not recognized (#22132)
Problem:    Ron files are not recognized.
Solution:   Recognize Ron files. (Amaan Qureshi, closes vim/vim#11948)

c8ef30bc2e
2023-02-06 10:01:17 +01:00
Mateusz Majewski
6c39edaa7e
fix(health): iterate using ipairs correctly (#22119)
In a few places ipairs was used to iterate over elements of the array.
However, the first return value of ipairs was erronously used, which is
not the value, but rather the index. This would result in errors, for
instance when trying to retrieve a field from the value.
2023-02-06 12:24:00 +08:00
Lewis Russell
7963a160e9
Merge pull request #21548 from figsoda/transform-capture
feat(treesitter): allow capture text to be transformed
2023-02-05 21:31:30 +00:00
Christian Clason
23e34fe534
vim-patch:9.0.1281: Cadence files are not recognized (#22130)
Problem:    Cadence files are not recognized.
Solution:   Recognize Cadence files. (Janez Podhostnik, closes vim/vim#11951)

cb626a4692

Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
2023-02-05 17:59:18 +01:00
figsoda
4c66f5ff97 feat(treesitter): respect metadata[id].range for offset! 2023-02-04 21:15:03 -05:00
figsoda
e1d5ad1cb8 feat(treesitter): add metadata option for get_node_text 2023-02-04 21:15:03 -05:00
figsoda
bb8845340b feat(treesitter): allow capture text to be transformed
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-02-04 21:04:45 -05:00
Christian Clason
4b9bb3a184
vim-patch:9.0.1278: go.work.sum files are not recognized (#22121)
Problem:    go.work.sum files are not recognized.
Solution:   Recognize go.work.sum files as the gosum filetype. (Amaan Qureshi,
            closes vim/vim#11940)

4ad8ae8465

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-02-04 16:05:45 +01:00
Lewis Russell
9a5678463c
fix(treesitter): fix most diagnostics 2023-02-04 14:58:38 +00:00
Christian Clason
c05b3c3bbd
vim-patch:9.0.1274: FIRRTL files are not recognized (#22102)
Problem:    FIRRTL files are not recognized.
Solution:   Add a pattern for FIRRTL files. (Amaan Qureshi, closes vim/vim#11931)

685bf83b73

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-02-02 17:26:22 +01:00
Lewis Russell
9ce44a750c
fix(man): use italics for <bs>_ (#22086)
fix(man): use italics for <bs>_

Even though underline is strictly what this should be. <bs>_ was used by
nroff to indicate italics which wasn't possible on old typewriters so
underline was used. Modern terminals now support italics so lets use
that now.

See:
- https://unix.stackexchange.com/questions/274658/purpose-of-ascii-text-with-overstriking-file-format/274795#274795
- https://cmd.inp.nsk.su/old/cmd2/manuals/unix/UNIX_Unleashed/ch08.htm
2023-02-01 17:21:42 +00:00
Christian Clason
d63ad600e0
vim-patch:9.0.1268: .clangd and .stylelintrc files don't get a filetype (#22079)
Problem:    .clangd and .stylelintrc files don't get a filetype.
Solution:   Use yaml for .clangd and json for .stylelintrc files. (Mark
            Skelton, closes vim/vim#11916)

9c51798a1f

Co-authored-by: Mark Skelton <mdskelton99@gmail.com>
2023-02-01 10:08:50 +01:00
bfredl
8376486e8f
Merge pull request #17537 from bfredl/neolua
refactor(tests): run unittests using main nvim binary - delete separate nvim-test build
2023-01-31 19:58:33 +01:00
Christian Clason
8b11cf5092
Merge pull request #22005 from clason/sanitize-lang
fix(treesitter): validate language name
2023-01-31 17:28:32 +01:00
bfredl
d6d6ab3f8e feat(lua): low-level interpreter mode (nvim -ll) 2023-01-31 13:53:22 +01:00
Christian Clason
b649a96fc0
vim-patch:9.0.1263: KDL files are not recognized (#22058)
Problem:    KDL files are not recognized.
Solution:   Add a pattern for KDL files. (Amaan Qureshi, closes vim/vim#11898)

907349a743

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-01-31 08:12:10 +01:00
dundargoc
27b81af19c
refactor!: remove has("debug") (#22060)
This value can not be relied on as it doesn't work for
multi-configuration generators. I don't think this undocumented option
is used much, if at all, so I think we should remove it.
2023-01-30 19:06:32 +01:00
Amaan Qureshi
c9ac4e4877
vim-patch:9.0.1261: Elsa files are not recognized (#22047)
Problem: Elsa files are not recognized.
Solution: Add the name of Elsa files. (Amaan Qureshi)

2a99fe6c41
2023-01-29 20:19:07 +01:00
Christian Clason
8144deb098
vim-patch:9.0.1256: NetworkManager connection files are not recognized (#22038)
Problem:    NetworkManager connection files are not recognized.
Solution:   Add a pattern for NetworkManager connection files. (closes vim/vim#11893)

04e4f1d985

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2023-01-29 10:39:20 +01:00
Christian Clason
c032e83b22 fix(treesitter): validate language name
Problem: Some injections (like markdown) allow specifying arbitrary
language names for code blocks, which may be lead to errors when
looking for a corresponding parser in runtime path.

Solution: Validate that the language name only contains alphanumeric
characters and `_` (e.g., for `c_sharp`) and error otherwise.
2023-01-28 11:28:52 +01:00
0xAdk
3c48d3c83f
fix(man.lua): open in current window if it's already a man page (#21987)
This matters when there are multiple man page windows open.
2023-01-25 22:39:25 +08:00
C.D. MacEachern
314d3ce1eb
docs(vim.fs): normalize Windows example was incorrect (#21966) 2023-01-25 06:45:30 +08:00
Lewis Russell
9166116c67
doc(lsp): format arguments to start_client() (#21980)
docs(lsp): format arguments to start_client()
2023-01-24 18:04:15 +00:00
Sean Dewar
bcdbf77537
fix(lsp): check method is supported when range formatting (#21970)
`vim.lsp.buf.format()` silently did nothing if no servers supported
`textDocument/rangeFormatting` when formatting with a range.

Issue found by `@hwrd:matrix.org` in the Matrix chat.
2023-01-24 07:15:43 +01:00
Arnout Engelen
cb757f2663
build: make generated source files reproducible #21586
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).

https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671
https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.

Solution:
- Update the code generation scripts to be deterministic.
    - That is only a partial solution: the exported function
      (funcs_metadata.generated.h) and ui event
      (ui_events_metadata.generated.h) metadata have some mpack'ed
      tables, which are not serialized deterministically.
    - As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
      inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
      that preserves table order.
    - Longer-term we should change the mpack'ed data structure so it no
      longer uses tables keyed by strings.

Closes #20124

Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
2023-01-23 01:26:46 -08:00
Amaan Qureshi
1b642648f6
vim-patch:9.0.1230: Apache Thrift files are not recognized (#21955)
Problem:    Apache thrift files are not recognized.
Solution:   Add a pattern for thrift files. (Amaan Qureshi, closes vim/vim#11859)

f3da4c8427
2023-01-23 07:08:08 +08:00
Mathias Fußenegger
8e52d8a394
fix(lsp): assert workspace/applyEdit receives params (#21945)
According to the specification `workspace/applyEdit` must be called with
`ApplyWorkspaceEditParams`.

So far the client just returned, which could lead to a misleading error
on the server side because `workspace/applyEdit` must respond with a
`ApplyWorkspaceEditResult`.

This adds an assertion to clarify that the server is violating the
specification.

See https://github.com/neovim/neovim/issues/21925
2023-01-22 18:54:09 +01:00
Amaan Qureshi
80bede1dfc
vim-patch:9.0.1229: Cap'n Proto files are not recognized (#21950)
Problem:    Cap'n Proto files are not recognized.
Solution:   Add a pattern and the "capnp" filetype. (Amaan Qureshi,
            closes vim/vim#11862)

040e795e8d
2023-01-22 22:08:33 +08:00
kishii
7ef5e363d3
feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905) 2023-01-21 08:22:34 +01:00
Raphael
d8d39344e3
fix(lsp): fix removed param value in add_workspace_folder (#21915) 2023-01-20 07:59:31 +01:00
Lewis Russell
20b7be2d10
fix(treesitter): really restore syntax
- also unset b:ts_highlight on stop()

Fixes: #21836
2023-01-17 16:56:23 +00:00
Sean Dewar
7e24c45221
feat(health): detect tmux RGB support via client_termfeatures
Problem: On tmux v3.2+, the `terminal-features` option may be used to enable RGB
capabilities over `terminal-overrides`. However, `show-messages` cannot be used
to detect if RGB capabilities are enabled using `terminal-features`.

Solution: Try to use `display-message -p #{client_termfeatures}` instead.
The returned features include "RGB" if either "RGB" is set in
`terminal-features`, or if "Tc" or "RGB" is set in `terminal-overrides` (as
before).
Nothing is returned by tmux versions older than v3.2, so fallback to checking
`show-messages` in that case.

Also, un-Vimscriptify the previous logic a bit, and change the error message to
point to using the `terminal-features` option instead for newer tmux versions.
2023-01-16 15:30:57 +00:00
Sean Dewar
60df0c0651
fix(health): fix tmux_esc_time comparison
Regression from the health.vim to .lua changes.

Unlike Vim script, Lua does not implicitly convert strings to numbers, so this
comparison threw an error.
2023-01-16 14:26:29 +00:00
Ching Pei Yang
ef89f9fd46
docs: treesitter.add_directive, add_predicate #21206 2023-01-16 04:39:19 -08:00
TJ DeVries
307efe4906
health: migrate to Lua #21661
* refactor: remove all vimscript from nvim/health
* fixup: previous method broke if you had a folder named 'x-lua'
2023-01-16 01:55:24 -08:00
Naru
34b973b1d9
docs(lua): use luaref tag instead of www.lua.org #21813 2023-01-15 13:32:23 -08:00
dundargoc
c752c85363
refactor: format with stylua (#21821) 2023-01-15 16:00:23 +01:00
Christian Clason
fd3d30a22c
vim-patch:9.0.1191: some Bazel files are not recognized (#21784)
Problem:    Some Bazel files are not recognized.
Solution:   Add an extra Bazel pattern. (Keith Smily, closes vim/vim#11807)

3213952966

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2023-01-13 17:27:35 +01:00
Raphael
572cd8031d
feat(diagnostic): vim.diagnostic.is_disabled() #21527 2023-01-12 08:57:39 -08:00
Chris Kipp
443bbfd59e
docs(lsp): fix type annotation on convert_input_to_markdown_lines (#21772)
This small changes just ensures that if you're using `convert_input_to_markdown_lines`
without `contents` you don't get a warning (when using something like neodev) that
there is an expected second param, since it can be nil.
2023-01-12 15:51:19 +01:00