Skip to content

Commit

Permalink
refactor(lua): move autocmds,filetype to runtime/modules (#1990)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyaowong committed May 20, 2024
1 parent fc48f03 commit c81e64d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
4 changes: 0 additions & 4 deletions runtime/lua/vscode-neovim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ local api = require("vscode-neovim.api")
local default_optons = require("vscode-neovim.default-options")
local cursor = require("vscode-neovim.cursor")
local highlight = require("vscode-neovim.highlight")
local filetype = require("vscode-neovim.filetype")
local autocmds = require("vscode-neovim.autocmds")
local sync_options = require("vscode-neovim.sync-options")

default_optons.setup()
cursor.setup()
highlight.setup()
filetype.setup()
autocmds.setup()
sync_options.setup()

local vscode = {
Expand Down
13 changes: 0 additions & 13 deletions runtime/lua/vscode-neovim/autocmds.lua

This file was deleted.

20 changes: 0 additions & 20 deletions runtime/lua/vscode-neovim/filetype.lua

This file was deleted.

14 changes: 14 additions & 0 deletions runtime/modules/filetype.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
vim.filetype.add({
pattern = {
-- To ensure that the user's fallback pattern is not overridden.
[".*.*.*"] = {
priority = -math.huge,
function(_, bufnr)
local name = vim.api.nvim_buf_get_name(bufnr)
if name:match("vscode%-notebook%-cell") then
return "python"
end
end,
},
},
})
10 changes: 10 additions & 0 deletions runtime/modules/integrations.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local code = require("vscode-neovim")

vim.api.nvim_create_autocmd("InsertLeave", {
group = vim.api.nvim_create_augroup("VSCodeCloseCompletionWidgets", { clear = true }),
callback = function()
code.action("hideSuggestWidget")
code.action("closeParameterHints")
code.action("editor.action.inlineSuggest.hide")
end,
})

0 comments on commit c81e64d

Please sign in to comment.