Skip to content

Commit 7c720b8

Browse files
committed
Merge pull request #117710 from HolonProduction/lsp/text-edit-string
LSP: Calculate simple string insertions on the server-side
2 parents d31bf4c + 82f308d commit 7c720b8

4 files changed

Lines changed: 152 additions & 119 deletions

File tree

core/object/script_language.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,27 @@ class ScriptLanguage : public Object {
305305
LOCATION_OTHER = 1 << 10,
306306
};
307307

308+
struct TextEdit {
309+
String new_text;
310+
int start_line = -1;
311+
int start_column;
312+
int end_line;
313+
int end_column;
314+
315+
_FORCE_INLINE_ bool is_set() const { return start_line != -1; }
316+
};
317+
308318
struct CodeCompletionOption {
309319
CodeCompletionKind kind = CODE_COMPLETION_KIND_PLAIN_TEXT;
310320
String display;
311321
String insert_text;
322+
/**
323+
* Optional server side calculated insertion.
324+
*
325+
* In contrast to `insert_text`, the editor must not do matching of preexisting text on `text_edit`.
326+
* Note: This is used by the language server, there is no support in the builtin editor for this property at the moment.
327+
*/
328+
TextEdit text_edit;
312329
Color font_color;
313330
Ref<Resource> icon;
314331
Variant default_value;

0 commit comments

Comments
 (0)