Skip to content

Commit

Permalink
Implement didClose notification in LSP
Browse files Browse the repository at this point in the history
  • Loading branch information
Razoric480 committed Jul 8, 2021
1 parent d4e5fe6 commit 1042901
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/gdscript/language_server/gdscript_text_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

void GDScriptTextDocument::_bind_methods() {
ClassDB::bind_method(D_METHOD("didOpen"), &GDScriptTextDocument::didOpen);
ClassDB::bind_method(D_METHOD("didClose"), &GDScriptTextDocument::didClose);
ClassDB::bind_method(D_METHOD("didChange"), &GDScriptTextDocument::didChange);
ClassDB::bind_method(D_METHOD("nativeSymbol"), &GDScriptTextDocument::nativeSymbol);
ClassDB::bind_method(D_METHOD("documentSymbol"), &GDScriptTextDocument::documentSymbol);
Expand All @@ -61,6 +62,11 @@ void GDScriptTextDocument::didOpen(const Variant &p_param) {
sync_script_content(doc.uri, doc.text);
}

void GDScriptTextDocument::didClose(const Variant &p_param) {
// Left empty on purpose. Godot does nothing special on closing a document,
// but it satisfies LSP clients that require didClose be implemented.
}

void GDScriptTextDocument::didChange(const Variant &p_param) {
lsp::TextDocumentItem doc = load_document_item(p_param);
Dictionary dict = p_param;
Expand Down
1 change: 1 addition & 0 deletions modules/gdscript/language_server/gdscript_text_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class GDScriptTextDocument : public RefCounted {
FileAccess *file_checker;

void didOpen(const Variant &p_param);
void didClose(const Variant &p_param);
void didChange(const Variant &p_param);

void sync_script_content(const String &p_path, const String &p_content);
Expand Down

0 comments on commit 1042901

Please sign in to comment.