feat: improve LSP lifecycle, terminal widget, and code folding support

- LSP:
  - Add shutdown and exit request/notification handling
  - Send initialized notification after initialize response
  - Gracefully close clients with delayed shutdown via GLib timeout
  - Fix LSP WS server ↔ Godot LSP communication flow

- Terminal (VteWidget):
  - Switch to async spawn with full environment inheritance
  - Add PROMPT_COMMAND OSC7 support for cwd tracking
  - Improve UX: scrollback, no audible bell, auto scroll
  - Implement clipboard shortcuts, selection copy, middle-click paste
  - Track cwd changes and update UI label
  - Add proper signal wiring and cleanup on destroy

- Code folding:
  - Add fold support for JS, HTML, CSS, JSON, C, C++, Go
  - Reset fold state safely when AST or filetype is unavailable

- UI (Plugins dialog):
  - Improve dialog behavior (non-modal, centered, transient)
  - Add focus-out auto-hide and Ctrl+Shift+P shortcut

- Misc:
  - Add type hints in VTE widget
  - Update TODOs (remove completed items, add LSP comm fix)
  - Add terminal plugin scaffolding
This commit is contained in:
2026-04-13 00:50:42 -05:00
parent d8e0185d1c
commit 12b5fe7304
15 changed files with 585 additions and 34 deletions

View File

@@ -25,6 +25,28 @@ FOLD_NODES = {
"with_statement",
"try_statement",
},
"javascript": {
"function_declaration",
"class_declaration",
"if_statement",
"for_statement",
"while_statement",
"switch_statement",
"try_statement",
},
"html": {
"element",
"attribute",
},
"css": {
"rule_set",
"selector",
"declaration",
},
"json": {
"object",
"array",
},
"java": {
"class_declaration",
"method_declaration",
@@ -35,8 +57,30 @@ FOLD_NODES = {
"switch_expression",
"block",
},
"json": {
"object",
"array",
"c": {
"function_definition",
"struct_definition",
"if_statement",
"for_statement",
"while_statement",
"switch_statement",
},
}
"cpp": {
"function_definition",
"class_definition",
"struct_definition",
"namespace_definition",
"if_statement",
"for_statement",
"while_statement",
"switch_statement",
},
"go": {
"function_declaration",
"type_declaration",
"if_statement",
"for_statement",
"select_statement",
"switch_statement",
},
}

View File

@@ -25,15 +25,19 @@ class Plugin(PluginCode):
self.view = event.view
event = Event_Factory.create_event(
"get_file", buffer=self.view.get_buffer()
"get_file", buffer = self.view.get_buffer()
)
self.emit_to("files", event)
file = event.response
if not file: return
if file.ftype not in FOLD_NODES: return
if not hasattr(file, "ast"): return
if file.ftype not in FOLD_NODES:
self.view.fold_start_set = {}
return
if not hasattr(file, "ast"):
self.view.fold_start_set = {}
return
buffer = file.buffer
if not buffer.get_tag_table().lookup("invisible"):