Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(type): add type annotation for defaults.lua #1333

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
014f98a
refactor(type): add type annotation for defaults.lua
pysan3 Feb 2, 2024
efcefd7
ci(lua_ls): add lua_ls actions to check type annotation
pysan3 Feb 2, 2024
fde92b3
chore: autoformat with stylua
pysan3 Feb 2, 2024
0c048b4
ci(lua_ls): force run type check on all branches for now
pysan3 Feb 2, 2024
5b8f58c
Merge branch 'add-type-annotations' of github.com:pysan3/neo-tree.nvi…
pysan3 Feb 2, 2024
f5d2207
fix(ci): fix typo
pysan3 Feb 2, 2024
913d998
ci(lua_ls): refer to types defined in the repo
pysan3 Feb 2, 2024
adee9b9
fix(type): better organized type names
pysan3 Feb 2, 2024
72776bc
refactor(type): move config types to another file
pysan3 Feb 3, 2024
ead7513
refactor(type): add types to log.lua
pysan3 Feb 3, 2024
e6236b9
refactor(type): add type for merge_config
pysan3 Feb 5, 2024
c331b7b
ci(lua_ls): add more files to check types
pysan3 Feb 5, 2024
4cfcbe2
refactor(defaults): move event_handler examples to wiki
pysan3 Feb 5, 2024
4b68620
refactor(types): add type files to library
pysan3 Feb 5, 2024
7744d57
refactor(types): ignore wrong or deprecated types
pysan3 Feb 5, 2024
e85fdcc
ci(lua_ls): remove unnecessary types to check
pysan3 Feb 5, 2024
a28b905
refactor(types): remove collections.lua from type check
pysan3 Feb 5, 2024
c4ab2c3
ci(lua_ls): make lua_ls typecheck run on PRs
pysan3 Feb 5, 2024
9ce9563
fix(type): add lacking field
pysan3 Feb 6, 2024
b42cefe
refactor(type): delete types to prevent lua_ls performance issue
pysan3 Feb 9, 2024
12a67ae
refactor(type): move component types to separate file
pysan3 Feb 9, 2024
710ddaf
refactor(type): add types to functions in common/components
pysan3 Feb 9, 2024
c1eaadb
refactor(type): capitalize all enum keys
pysan3 Feb 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(defaults): move event_handler examples to wiki
  • Loading branch information
pysan3 committed Feb 5, 2024
commit 4cfcbe2cc27b6324e501c96be8dd30751e0c209e
103 changes: 11 additions & 92 deletions lua/neo-tree/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -511,102 +511,21 @@ config.document_symbols = {
Event = { icon = "", hl = "Constant" },
Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" },
TypeAlias = { icon = " ", hl = "Type" },
Parameter = { icon = " ", hl = "@parameter" },
StaticMethod = { icon = "󰠄 ", hl = "Function" },
Macro = { icon = " ", hl = "Macro" },
},
custom_kinds = {
[252] = "TypeAlias",
[253] = "Parameter",
[254] = "StaticMethod",
[255] = "Macro",
},
custom_kinds = {},
}

---@type NeotreeConfig.event_handler[]
-- TODO: Move event_handler examples to wiki
-- See http:https://TODO/make/wiki/page for examples.
---@see https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#events for examples.
config.event_handlers = {}

-- config.event_handlers = {
-- {
-- event = "before_render",
-- handler = function(state)
-- -- add something to the state that can be used by custom components
-- end,
-- },
-- {
-- event = "file_opened",
-- handler = function(file_path)
-- --auto close
-- require("neo-tree.command").execute({ action = "close" })
-- end,
-- },
-- {
-- event = "file_opened",
-- handler = function(file_path)
-- --clear search after opening a file
-- require("neo-tree.sources.filesystem").reset_search()
-- end,
-- },
-- {
-- event = "file_renamed",
-- handler = function(args)
-- -- fix references to file
-- print(args.source, " renamed to ", args.destination)
-- end,
-- },
-- {
-- event = "file_moved",
-- handler = function(args)
-- -- fix references to file
-- print(args.source, " moved to ", args.destination)
-- end,
-- },
-- {
-- event = "neo_tree_buffer_enter",
-- handler = function()
-- vim.cmd("highlight! Cursor blend=100")
-- end,
-- },
-- {
-- event = "neo_tree_buffer_leave",
-- handler = function()
-- vim.cmd("highlight! Cursor guibg=#5f87af blend=0")
-- end,
-- },
-- {
-- event = "neo_tree_window_before_open",
-- handler = function(args)
-- print("neo_tree_window_before_open", vim.inspect(args))
-- end,
-- },
-- {
-- event = "neo_tree_window_after_open",
-- handler = function(args)
-- vim.cmd("wincmd =")
-- end,
-- },
-- {
-- event = "neo_tree_window_before_close",
-- handler = function(args)
-- print("neo_tree_window_before_close", vim.inspect(args))
-- end,
-- },
-- {
-- event = "neo_tree_window_after_close",
-- handler = function(args)
-- vim.cmd("wincmd =")
-- end,
-- },
-- }

-- TODO: Add this hack to wiki.
-- kinds = {
-- -- ccls
-- -- TypeAlias = { icon = ' ', hl = 'Type' },
-- -- Parameter = { icon = ' ', hl = '@parameter' },
-- -- StaticMethod = { icon = '󰠄 ', hl = 'Function' },
-- -- Macro = { icon = ' ', hl = 'Macro' },
-- }
-- custom_kinds = {
-- -- ccls
-- [252] = 'TypeAlias',
-- [253] = 'Parameter',
-- [254] = 'StaticMethod',
-- [255] = 'Macro',
-- }

return config
Loading