File tree Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 11# Godot Language Pack
22
3- ** Requirements:** ` Godot ` needs to be running to use LSP and DAP for gdscript
3+ ** Requirements:** Godot needs to be running to use LSP and DAP for GDScript
44
55This plugin pack does the following:
66
@@ -9,4 +9,5 @@ This plugin pack does the following:
99- Adds ` gdscript ` treesitter parsers
1010- Adds ` godot_resource ` treesitter parsers
1111- Adds ` glsl ` treesitter parsers
12- - Adds [ quickgd.nvim] ( https://github.com/QuickGD/quickgd.nvim )
12+ - Adds [ quickgd.nvim] ( https://github.com/QuickGD/quickgd.nvim ) to provide commands for starting Godot
13+ - Adds [ godot-server.nvim] ( https://github.com/Cretezy/godot-server.nvim ) to open files from Godot in Neovim. Requires configuration in the Godot editor (see [ project page] ( https://github.com/Cretezy/godot-server.nvim ) )
Original file line number Diff line number Diff line change 1+ local function gd_move_handler (source , destination )
2+ if not vim .fs .root (source , " project.godot" ) then return end -- only run in godot projects
3+ local suffix = source :match " %.gd$" and " uid" or " import"
4+ local tmp_file = (" %s.%s" ):format (source , suffix )
5+ local tmp_stat = vim .uv .fs_stat (tmp_file )
6+
7+ if tmp_stat then
8+ -- Rename the temporary file
9+ local new_tmp_file = (" %s.%s" ):format (destination , suffix )
10+ local success , err = vim .uv .fs_rename (tmp_file , new_tmp_file )
11+ if not success then
12+ vim .notify ((" Failed to rename Godot file: `%s`\n ```\n %s\n ```" ):format (tmp_file , err or " unknown error" ))
13+ end
14+ end
15+ end
16+
117return {
218 {
319 " AstroNvim/astrocore" ,
@@ -73,4 +89,39 @@ return {
7389 end
7490 end ,
7591 },
92+ {
93+ " nvim-neo-tree/neo-tree.nvim" ,
94+ optional = true ,
95+ opts = {
96+ event_handlers = {
97+ {
98+ event = " file_renamed" ,
99+ handler = function (args ) gd_move_handler (args .source , args .destination ) end ,
100+ id = " godot_handler" ,
101+ },
102+ {
103+ event = " file_moved" ,
104+ handler = function (args ) gd_move_handler (args .source , args .destination ) end ,
105+ id = " godot_handler" ,
106+ },
107+ },
108+ nesting_rules = {
109+ godot_import = {
110+ pattern = " ^(.*)$" ,
111+ files = { -- pretty loose, but is probably a specific enough pattern to be alright
112+ " %1.import" ,
113+ },
114+ },
115+ godot_uid = {
116+ pattern = " ^(.*%.gd)$" ,
117+ files = {
118+ " %1.uid" ,
119+ },
120+ },
121+ },
122+ },
123+ },
124+ {
125+ " Cretezy/godot-server.nvim" ,
126+ },
76127}
You can’t perform that action at this time.
0 commit comments