From 1581e054be9533f8ae325b49ea5df0d45563ce0c Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sat, 8 Feb 2025 14:45:02 +0800 Subject: [PATCH] fix(service): fix completions of ident with dot --- crates/service/src/features/completion.rs | 229 +++++++++--------- ...atures__completion__block__block_type.snap | 75 +++++- .../features__completion__block__blocks.snap | 75 +++++- ...etion__block__blocks_following_dollar.snap | 91 ++++++- ...letion__block__blocks_following_ident.snap | 91 ++++++- ...tion__block__blocks_following_int_idx.snap | 75 +++++- ...__completion__block__multiple_indexes.snap | 75 +++++- ...eatures__completion__data__memory_idx.snap | 15 +- .../features__completion__elem__func_idx.snap | 13 + ...eatures__completion__elem__func_idxes.snap | 13 + ...features__completion__elem__table_idx.snap | 15 +- .../features__completion__func__call.snap | 26 ++ ...s__completion__func__call_in_sequence.snap | 26 ++ ...eatures__completion__func__call_named.snap | 13 + ...on__func__call_named_following_dollar.snap | 14 +- ...mpletion__func__call_named_incomplete.snap | 14 +- ...atures__completion__func__doc_comment.snap | 26 ++ ...s__completion__func__export_desc_func.snap | 13 + ...nc__export_desc_func_following_dollar.snap | 14 +- ...on__func__export_desc_func_incomplete.snap | 14 +- ...ures__completion__func__label_details.snap | 65 +++++ ..._completion__func__module_field_start.snap | 26 ++ ...__module_field_start_following_dollar.snap | 13 + ...__func__module_field_start_incomplete.snap | 14 +- .../features__completion__func__ref_func.snap | 26 ++ ...es__completion__func_type__func_types.snap | 30 ++- ...unc_type__func_types_following_dollar.snap | 31 ++- ...func_type__func_types_following_ident.snap | 31 ++- ...nc_type__func_types_following_int_idx.snap | 30 ++- .../features__completion__global__export.snap | 30 ++- ...tion__global__export_following_dollar.snap | 34 ++- ...etion__global__export_following_ident.snap | 34 ++- ...ion__global__export_following_int_idx.snap | 30 ++- ...features__completion__global__globals.snap | 30 ++- ...ion__global__globals_following_dollar.snap | 34 ++- ...tion__global__globals_following_ident.snap | 34 ++- ...on__global__globals_following_int_idx.snap | 30 ++- ...ures__completion__global__in_sequence.snap | 30 ++- ...etion__global__preferred_type_by_call.snap | 60 ++++- ...tion__global__preferred_type_by_instr.snap | 60 ++++- ...tures__completion__local__in_sequence.snap | 90 ++++++- ..._completion__local__locals_and_params.snap | 90 ++++++- ...l__locals_and_params_following_dollar.snap | 108 ++++++++- ...al__locals_and_params_following_ident.snap | 108 ++++++++- ...__locals_and_params_following_int_idx.snap | 90 ++++++- ..._locals_and_params_in_different_funcs.snap | 30 ++- ...letion__local__preferred_type_by_call.snap | 56 ++++- ...etion__local__preferred_type_by_instr.snap | 56 ++++- ...ompletion__memory__export_desc_memory.snap | 15 +- ...__export_desc_memory_following_dollar.snap | 14 +- ...memory__export_desc_memory_incomplete.snap | 14 +- ...ompletion__table__elem_without_parens.snap | 13 + .../features__completion__table__export.snap | 30 ++- ...on__table__export_following_int_index.snap | 30 ++- ...atures__completion__table__table_size.snap | 30 ++- ...n__table__table_size_following_dollar.snap | 31 ++- ...n__table__table_size_incomplete_ident.snap | 31 ++- 57 files changed, 2221 insertions(+), 214 deletions(-) diff --git a/crates/service/src/features/completion.rs b/crates/service/src/features/completion.rs index d3086dc..10bce74 100644 --- a/crates/service/src/features/completion.rs +++ b/crates/service/src/features/completion.rs @@ -1,16 +1,17 @@ use crate::{ - binder::{SymbolKey, SymbolKind, SymbolTable, SymbolTablesCtx}, + binder::{SymbolKey, SymbolKind, SymbolTablesCtx}, data_set, helpers, - idx::{IdentsCtx, Idx}, + idx::Idx, syntax_tree::SyntaxTreeCtx, types_analyzer::{self, OperandType, TypesAnalyzerCtx, ValType}, uri::{InternUri, UrisCtx}, LanguageService, }; use itertools::Itertools; +use line_index::LineIndex; use lsp_types::{ CompletionItem, CompletionItemKind, CompletionItemLabelDetails, CompletionParams, - CompletionResponse, Documentation, MarkupContent, MarkupKind, + CompletionResponse, CompletionTextEdit, Documentation, MarkupContent, MarkupKind, TextEdit, }; use rowan::{ast::support, Direction}; use smallvec::SmallVec; @@ -28,7 +29,7 @@ impl LanguageService { )?; let cmp_ctx = get_cmp_ctx(&token)?; - let items = get_cmp_list(self, cmp_ctx, &token, uri, &self.symbol_table(uri), &root); + let items = get_cmp_list(self, cmp_ctx, &token, uri, &line_index, &root); Some(CompletionResponse::Array(items)) } } @@ -453,9 +454,10 @@ fn get_cmp_list( ctx: SmallVec<[CmpCtx; 4]>, token: &SyntaxToken, uri: InternUri, - symbol_table: &SymbolTable, + line_index: &LineIndex, root: &SyntaxNode, ) -> Vec { + let symbol_table = service.symbol_table(uri); ctx.into_iter() .fold(Vec::with_capacity(2), |mut items, ctx| { match ctx { @@ -516,7 +518,6 @@ fn get_cmp_list( }; let func = SymbolKey::new(&func); let preferred_type = guess_preferred_type(service, uri, token); - let has_dollar = token.text().starts_with('$'); items.extend( symbol_table .symbols @@ -525,14 +526,19 @@ fn get_cmp_list( matches!(symbol.kind, SymbolKind::Param | SymbolKind::Local) && symbol.region == func }) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; + .map(|symbol| { + let label = symbol.idx.render(service).to_string(); let ty = service.extract_type(symbol.green.clone()); - Some(CompletionItem { - label, - insert_text, + CompletionItem { + label: label.clone(), kind: Some(CompletionItemKind::VARIABLE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), label_details: ty.map(|ty| CompletionItemLabelDetails { description: Some(ty.to_string()), ..Default::default() @@ -545,7 +551,7 @@ fn get_cmp_list( } }), ..Default::default() - }) + } }), ); } @@ -556,47 +562,41 @@ fn get_cmp_list( else { return items; }; - let has_dollar = token.text().starts_with('$'); - items.extend( - symbol_table - .get_declared(module, SymbolKind::Func) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; - Some(CompletionItem { - label, - insert_text, - kind: Some(CompletionItemKind::FUNCTION), - detail: Some(service.render_func_header( - symbol.idx.name, - service.get_func_sig(uri, symbol.key, symbol.green.clone()), - )), - label_details: Some(CompletionItemLabelDetails { - description: Some( - service.render_compact_sig( - service - .get_func_sig( - uri, - symbol.key, - symbol.green.clone(), - ) - .unwrap_or_default(), - ), + items.extend(symbol_table.get_declared(module, SymbolKind::Func).map( + |symbol| { + let label = symbol.idx.render(service).to_string(); + CompletionItem { + label: label.clone(), + kind: Some(CompletionItemKind::FUNCTION), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), + detail: Some(service.render_func_header( + symbol.idx.name, + service.get_func_sig(uri, symbol.key, symbol.green.clone()), + )), + label_details: Some(CompletionItemLabelDetails { + description: Some( + service.render_compact_sig( + service + .get_func_sig(uri, symbol.key, symbol.green.clone()) + .unwrap_or_default(), ), - ..Default::default() - }), - documentation: Some(Documentation::MarkupContent( - MarkupContent { - kind: MarkupKind::Markdown, - value: helpers::ast::get_doc_comment( - &symbol.key.to_node(root), - ), - }, - )), + ), ..Default::default() - }) - }), - ); + }), + documentation: Some(Documentation::MarkupContent(MarkupContent { + kind: MarkupKind::Markdown, + value: helpers::ast::get_doc_comment(&symbol.key.to_node(root)), + })), + ..Default::default() + } + }, + )); } CmpCtx::FuncType => { let Some(module) = token @@ -605,21 +605,23 @@ fn get_cmp_list( else { return items; }; - let has_dollar = token.text().starts_with('$'); - items.extend( - symbol_table - .get_declared(module, SymbolKind::Type) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; - Some(CompletionItem { - label, - insert_text, - kind: Some(CompletionItemKind::INTERFACE), - ..Default::default() - }) - }), - ); + items.extend(symbol_table.get_declared(module, SymbolKind::Type).map( + |symbol| { + let label = symbol.idx.render(service).to_string(); + CompletionItem { + label: label.clone(), + kind: Some(CompletionItemKind::INTERFACE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), + ..Default::default() + } + }, + )); } CmpCtx::Global => { let Some(module) = token @@ -629,18 +631,22 @@ fn get_cmp_list( return items; }; let preferred_type = guess_preferred_type(service, uri, token); - let has_dollar = token.text().starts_with('$'); items.extend( symbol_table .get_declared(module, SymbolKind::GlobalDef) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; + .map(|symbol| { + let label = symbol.idx.render(service).to_string(); let ty = service.extract_global_type(symbol.green.clone()); - Some(CompletionItem { - label, - insert_text, + CompletionItem { + label: label.clone(), kind: Some(CompletionItemKind::VARIABLE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), label_details: ty.map(|ty| CompletionItemLabelDetails { description: Some(ty.to_string()), ..Default::default() @@ -653,7 +659,7 @@ fn get_cmp_list( } }), ..Default::default() - }) + } }), ); } @@ -671,19 +677,23 @@ fn get_cmp_list( else { return items; }; - let has_dollar = token.text().starts_with('$'); items.extend( symbol_table .get_declared(module, SymbolKind::MemoryDef) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; - Some(CompletionItem { - label, - insert_text, + .map(|symbol| { + let label = symbol.idx.render(service).to_string(); + CompletionItem { + label: label.clone(), kind: Some(CompletionItemKind::VARIABLE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), ..Default::default() - }) + } }), ); } @@ -695,7 +705,6 @@ fn get_cmp_list( else { return items; }; - let has_dollar = token.text().starts_with('$'); items.extend( symbol_table .symbols @@ -703,20 +712,24 @@ fn get_cmp_list( .filter(|symbol| { symbol.kind == SymbolKind::TableDef && symbol.region == module }) - .filter_map(|symbol| { - let (label, insert_text) = - get_idx_cmp_text(service, &symbol.idx, has_dollar)?; - Some(CompletionItem { - label, - insert_text, + .map(|symbol| { + let label = symbol.idx.render(service).to_string(); + CompletionItem { + label: label.clone(), kind: Some(CompletionItemKind::VARIABLE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), ..Default::default() - }) + } }), ); } CmpCtx::Block => { - let has_dollar = token.text().starts_with('$'); items.extend( symbol_table .symbols @@ -727,19 +740,24 @@ fn get_cmp_list( }) .rev() .enumerate() - .filter_map(|(num, symbol)| { + .map(|(num, symbol)| { let idx = Idx { num: Some(num as u32), name: symbol.idx.name, }; - let (label, insert_text) = - get_idx_cmp_text(service, &idx, has_dollar)?; + let label = idx.render(service).to_string(); let block_node = symbol.key.to_node(root); let sig = types_analyzer::get_block_sig(service, uri, &block_node); - Some(CompletionItem { - label, - insert_text, + CompletionItem { + label: label.clone(), kind: Some(CompletionItemKind::VARIABLE), + text_edit: Some(CompletionTextEdit::Edit(TextEdit { + range: helpers::rowan_range_to_lsp_range( + line_index, + token.text_range(), + ), + new_text: label, + })), label_details: Some(CompletionItemLabelDetails { description: Some(format!( "[{}]", @@ -755,7 +773,7 @@ fn get_cmp_list( sig, )), ..Default::default() - }) + } }), ); } @@ -855,19 +873,6 @@ fn get_cmp_list( }) } -fn get_idx_cmp_text( - service: &LanguageService, - idx: &Idx, - has_dollar: bool, -) -> Option<(String, Option)> { - if has_dollar { - let name = service.lookup_ident(idx.name?); - Some((name.to_string(), Some(name.strip_prefix('$')?.to_string()))) - } else { - Some((idx.render(service).to_string(), None)) - } -} - fn find_leading_l_paren(token: &SyntaxToken) -> Option { if is_l_paren(token) { Some(token.clone()) diff --git a/crates/service/tests/completion/snapshots/features__completion__block__block_type.snap b/crates/service/tests/completion/snapshots/features__completion__block__block_type.snap index fbe79cf..ff210a7 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__block_type.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__block_type.snap @@ -9,7 +9,20 @@ expression: response "description": "[i32, i32]" }, "kind": 6, - "detail": "(if $b (result i32) (result i32))" + "detail": "(if $b (result i32) (result i32))", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 23 + }, + "end": { + "line": 9, + "character": 24 + } + }, + "newText": "$b" + } }, { "label": "1", @@ -17,7 +30,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 23 + }, + "end": { + "line": 9, + "character": 24 + } + }, + "newText": "1" + } }, { "label": "2", @@ -25,7 +51,20 @@ expression: response "description": "[i32]" }, "kind": 6, - "detail": "(block (param i32) (param i32) (result i32))" + "detail": "(block (param i32) (param i32) (result i32))", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 23 + }, + "end": { + "line": 9, + "character": 24 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -33,7 +72,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $a)" + "detail": "(block $a)", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 23 + }, + "end": { + "line": 9, + "character": 24 + } + }, + "newText": "$a" + } }, { "label": "4", @@ -41,6 +93,19 @@ expression: response "description": "[i32]" }, "kind": 6, - "detail": "(loop (result i32))" + "detail": "(loop (result i32))", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 23 + }, + "end": { + "line": 9, + "character": 24 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__block__blocks.snap b/crates/service/tests/completion/snapshots/features__completion__block__blocks.snap index 14d9fba..ddb5ba9 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__blocks.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__blocks.snap @@ -9,7 +9,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $b)" + "detail": "(block $b)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 23 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "newText": "$b" + } }, { "label": "1", @@ -17,7 +30,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 23 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "newText": "1" + } }, { "label": "2", @@ -25,7 +51,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 23 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -33,7 +72,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $a)" + "detail": "(block $a)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 23 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "newText": "$a" + } }, { "label": "4", @@ -41,6 +93,19 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 23 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_dollar.snap index cee79c7..edc3999 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_dollar.snap @@ -10,7 +10,61 @@ expression: response }, "kind": 6, "detail": "(block $b)", - "insertText": "b" + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "$b" + } + }, + { + "label": "1", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "1" + } + }, + { + "label": "2", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -19,6 +73,39 @@ expression: response }, "kind": 6, "detail": "(block $a)", - "insertText": "a" + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "$a" + } + }, + { + "label": "4", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_ident.snap b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_ident.snap index cee79c7..741e9d4 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_ident.snap @@ -10,7 +10,61 @@ expression: response }, "kind": 6, "detail": "(block $b)", - "insertText": "b" + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "newText": "$b" + } + }, + { + "label": "1", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "newText": "1" + } + }, + { + "label": "2", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -19,6 +73,39 @@ expression: response }, "kind": 6, "detail": "(block $a)", - "insertText": "a" + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "newText": "$a" + } + }, + { + "label": "4", + "labelDetails": { + "description": "[]" + }, + "kind": 6, + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_int_idx.snap b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_int_idx.snap index 14d9fba..edc3999 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_int_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__blocks_following_int_idx.snap @@ -9,7 +9,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $b)" + "detail": "(block $b)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "$b" + } }, { "label": "1", @@ -17,7 +30,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "1" + } }, { "label": "2", @@ -25,7 +51,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -33,7 +72,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $a)" + "detail": "(block $a)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "$a" + } }, { "label": "4", @@ -41,6 +93,19 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 24 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__block__multiple_indexes.snap b/crates/service/tests/completion/snapshots/features__completion__block__multiple_indexes.snap index 14d9fba..c4bfe6b 100644 --- a/crates/service/tests/completion/snapshots/features__completion__block__multiple_indexes.snap +++ b/crates/service/tests/completion/snapshots/features__completion__block__multiple_indexes.snap @@ -9,7 +9,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $b)" + "detail": "(block $b)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 28 + }, + "end": { + "line": 8, + "character": 29 + } + }, + "newText": "$b" + } }, { "label": "1", @@ -17,7 +30,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 28 + }, + "end": { + "line": 8, + "character": 29 + } + }, + "newText": "1" + } }, { "label": "2", @@ -25,7 +51,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 28 + }, + "end": { + "line": 8, + "character": 29 + } + }, + "newText": "2" + } }, { "label": "$a", @@ -33,7 +72,20 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block $a)" + "detail": "(block $a)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 28 + }, + "end": { + "line": 8, + "character": 29 + } + }, + "newText": "$a" + } }, { "label": "4", @@ -41,6 +93,19 @@ expression: response "description": "[]" }, "kind": 6, - "detail": "(block)" + "detail": "(block)", + "textEdit": { + "range": { + "start": { + "line": 8, + "character": 28 + }, + "end": { + "line": 8, + "character": 29 + } + }, + "newText": "4" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__data__memory_idx.snap b/crates/service/tests/completion/snapshots/features__completion__data__memory_idx.snap index 8e31b32..4d67bb7 100644 --- a/crates/service/tests/completion/snapshots/features__completion__data__memory_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__data__memory_idx.snap @@ -5,6 +5,19 @@ expression: response [ { "label": "$m", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "newText": "$m" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__elem__func_idx.snap b/crates/service/tests/completion/snapshots/features__completion__elem__func_idx.snap index 4a9cfba..b14c8c9 100644 --- a/crates/service/tests/completion/snapshots/features__completion__elem__func_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__elem__func_idx.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 14 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "newText": "$f" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__elem__func_idxes.snap b/crates/service/tests/completion/snapshots/features__completion__elem__func_idxes.snap index 4a9cfba..6ae5fc2 100644 --- a/crates/service/tests/completion/snapshots/features__completion__elem__func_idxes.snap +++ b/crates/service/tests/completion/snapshots/features__completion__elem__func_idxes.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "newText": "$f" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__elem__table_idx.snap b/crates/service/tests/completion/snapshots/features__completion__elem__table_idx.snap index 34d01d9..2f0e99b 100644 --- a/crates/service/tests/completion/snapshots/features__completion__elem__table_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__elem__table_idx.snap @@ -5,6 +5,19 @@ expression: response [ { "label": "$table", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "newText": "$table" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__call.snap b/crates/service/tests/completion/snapshots/features__completion__func__call.snap index cc87a52..43e3eba 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__call.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__call.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__call_in_sequence.snap b/crates/service/tests/completion/snapshots/features__completion__func__call_in_sequence.snap index 73f11ec..0ed80dc 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__call_in_sequence.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__call_in_sequence.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 14 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 14 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "newText": "$func" } }, { diff --git a/crates/service/tests/completion/snapshots/features__completion__func__call_named.snap b/crates/service/tests/completion/snapshots/features__completion__func__call_named.snap index ec73d04..bcc6a4d 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__call_named.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__call_named.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 21 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__call_named_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__func__call_named_following_dollar.snap index f200091..8daa3ba 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__call_named_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__call_named_following_dollar.snap @@ -14,6 +14,18 @@ expression: response "kind": "markdown", "value": "" }, - "insertText": "func" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "$func" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__call_named_incomplete.snap b/crates/service/tests/completion/snapshots/features__completion__func__call_named_incomplete.snap index f200091..41aa21f 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__call_named_incomplete.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__call_named_incomplete.snap @@ -14,6 +14,18 @@ expression: response "kind": "markdown", "value": "" }, - "insertText": "func" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 24 + } + }, + "newText": "$func" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__doc_comment.snap b/crates/service/tests/completion/snapshots/features__completion__func__doc_comment.snap index d99de8e..2267c8b 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__doc_comment.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__doc_comment.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "doc comment" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func.snap b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func.snap index ec73d04..2b40caa 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_following_dollar.snap index f200091..9710d04 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_following_dollar.snap @@ -14,6 +14,18 @@ expression: response "kind": "markdown", "value": "" }, - "insertText": "func" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 18 + }, + "end": { + "line": 2, + "character": 19 + } + }, + "newText": "$func" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_incomplete.snap b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_incomplete.snap index f200091..9bc2985 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_incomplete.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__export_desc_func_incomplete.snap @@ -14,6 +14,18 @@ expression: response "kind": "markdown", "value": "" }, - "insertText": "func" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 18 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "newText": "$func" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__label_details.snap b/crates/service/tests/completion/snapshots/features__completion__func__label_details.snap index 0f30260..b8f4cbf 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__label_details.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__label_details.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$f1" } }, { @@ -37,6 +63,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$f2" } }, { @@ -49,6 +88,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$f3" } }, { @@ -61,6 +113,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$f4" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start.snap b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start.snap index cc87a52..f026ad7 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 10 + }, + "end": { + "line": 3, + "character": 11 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 10 + }, + "end": { + "line": 3, + "character": 11 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_following_dollar.snap index ec73d04..a96dbef 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_following_dollar.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_incomplete.snap b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_incomplete.snap index f200091..fadc8a6 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_incomplete.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__module_field_start_incomplete.snap @@ -14,6 +14,18 @@ expression: response "kind": "markdown", "value": "" }, - "insertText": "func" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 11 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "newText": "$func" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func__ref_func.snap b/crates/service/tests/completion/snapshots/features__completion__func__ref_func.snap index cc87a52..900eb53 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func__ref_func.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func__ref_func.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 19 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "newText": "0" } }, { @@ -25,6 +38,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 19 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "newText": "$func" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types.snap b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types.snap index c16f8cb..06e07f0 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types.snap @@ -5,10 +5,36 @@ expression: response [ { "label": "0", - "kind": 8 + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "0" + } }, { "label": "$type", - "kind": 8 + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "newText": "$type" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_dollar.snap index fd39f2f..07cace9 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_dollar.snap @@ -3,9 +3,38 @@ source: crates/service/tests/completion/func_type.rs expression: response --- [ + { + "label": "0", + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "newText": "0" + } + }, { "label": "$type", "kind": 8, - "insertText": "type" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "newText": "$type" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_ident.snap b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_ident.snap index fd39f2f..f373f96 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_ident.snap @@ -3,9 +3,38 @@ source: crates/service/tests/completion/func_type.rs expression: response --- [ + { + "label": "0", + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "newText": "0" + } + }, { "label": "$type", "kind": 8, - "insertText": "type" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "newText": "$type" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_int_idx.snap b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_int_idx.snap index c16f8cb..07cace9 100644 --- a/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_int_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__func_type__func_types_following_int_idx.snap @@ -5,10 +5,36 @@ expression: response [ { "label": "0", - "kind": 8 + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "newText": "0" + } }, { "label": "$type", - "kind": 8 + "kind": 8, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "newText": "$type" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__export.snap b/crates/service/tests/completion/snapshots/features__completion__global__export.snap index 0ff59ff..b23e3a8 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__export.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__export.snap @@ -8,13 +8,39 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 22 + }, + "end": { + "line": 4, + "character": 23 + } + }, + "newText": "0" + } }, { "label": "$global", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 22 + }, + "end": { + "line": 4, + "character": 23 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__export_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__global__export_following_dollar.snap index c6b806f..e4b839c 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__export_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__export_following_dollar.snap @@ -3,12 +3,44 @@ source: crates/service/tests/completion/global.rs expression: response --- [ + { + "label": "0", + "labelDetails": { + "description": "i32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "newText": "0" + } + }, { "label": "$global", "labelDetails": { "description": "i32" }, "kind": 6, - "insertText": "global" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__export_following_ident.snap b/crates/service/tests/completion/snapshots/features__completion__global__export_following_ident.snap index c6b806f..c73ea47 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__export_following_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__export_following_ident.snap @@ -3,12 +3,44 @@ source: crates/service/tests/completion/global.rs expression: response --- [ + { + "label": "0", + "labelDetails": { + "description": "i32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 25 + } + }, + "newText": "0" + } + }, { "label": "$global", "labelDetails": { "description": "i32" }, "kind": 6, - "insertText": "global" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 25 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__export_following_int_idx.snap b/crates/service/tests/completion/snapshots/features__completion__global__export_following_int_idx.snap index 0ff59ff..e4b839c 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__export_following_int_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__export_following_int_idx.snap @@ -8,13 +8,39 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "newText": "0" + } }, { "label": "$global", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 23 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__globals.snap b/crates/service/tests/completion/snapshots/features__completion__global__globals.snap index 0ff59ff..bcda900 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__globals.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__globals.snap @@ -8,13 +8,39 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 21 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "newText": "0" + } }, { "label": "$global", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 21 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_dollar.snap index c6b806f..8ad138e 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_dollar.snap @@ -3,12 +3,44 @@ source: crates/service/tests/completion/global.rs expression: response --- [ + { + "label": "0", + "labelDetails": { + "description": "i32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "0" + } + }, { "label": "$global", "labelDetails": { "description": "i32" }, "kind": 6, - "insertText": "global" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_ident.snap b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_ident.snap index c6b806f..151a433 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_ident.snap @@ -3,12 +3,44 @@ source: crates/service/tests/completion/global.rs expression: response --- [ + { + "label": "0", + "labelDetails": { + "description": "i32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 24 + } + }, + "newText": "0" + } + }, { "label": "$global", "labelDetails": { "description": "i32" }, "kind": 6, - "insertText": "global" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 24 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_int_idx.snap b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_int_idx.snap index 0ff59ff..8ad138e 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__globals_following_int_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__globals_following_int_idx.snap @@ -8,13 +8,39 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "0" + } }, { "label": "$global", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "$global" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__in_sequence.snap b/crates/service/tests/completion/snapshots/features__completion__global__in_sequence.snap index 90c558d..d40b716 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__in_sequence.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__in_sequence.snap @@ -8,14 +8,40 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 20 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "newText": "0" + } }, { "label": "$global", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 20 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "newText": "$global" + } }, { "label": "unreachable", diff --git a/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_call.snap b/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_call.snap index 6221fd0..4630e2c 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_call.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_call.snap @@ -9,7 +9,20 @@ expression: response "description": "i32" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$a" + } }, { "label": "$b", @@ -17,7 +30,20 @@ expression: response "description": "i64" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$b" + } }, { "label": "$c", @@ -25,7 +51,20 @@ expression: response "description": "f32" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$c" + } }, { "label": "$d", @@ -33,6 +72,19 @@ expression: response "description": "f64" }, "kind": 6, - "sortText": "0" + "sortText": "0", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$d" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_instr.snap b/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_instr.snap index 4e79dec..14065f2 100644 --- a/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_instr.snap +++ b/crates/service/tests/completion/snapshots/features__completion__global__preferred_type_by_instr.snap @@ -9,7 +9,20 @@ expression: response "description": "i32" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$a" + } }, { "label": "$b", @@ -17,7 +30,20 @@ expression: response "description": "i64" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$b" + } }, { "label": "$c", @@ -25,7 +51,20 @@ expression: response "description": "f32" }, "kind": 6, - "sortText": "0" + "sortText": "0", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$c" + } }, { "label": "$d", @@ -33,6 +72,19 @@ expression: response "description": "f64" }, "kind": 6, - "sortText": "1" + "sortText": "1", + "textEdit": { + "range": { + "start": { + "line": 9, + "character": 17 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "newText": "$d" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__in_sequence.snap b/crates/service/tests/completion/snapshots/features__completion__local__in_sequence.snap index 9605b47..8e303e3 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__in_sequence.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__in_sequence.snap @@ -8,42 +8,120 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "$p" + } }, { "label": "1", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "1" + } }, { "label": "2", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "2" + } }, { "label": "$l", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "$l" + } }, { "label": "4", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "4" + } }, { "label": "5", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 17 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "5" + } }, { "label": "unreachable", diff --git a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params.snap b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params.snap index 084557c..2ef7d52 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params.snap @@ -8,41 +8,119 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "$p" + } }, { "label": "1", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "1" + } }, { "label": "2", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "2" + } }, { "label": "$l", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "$l" + } }, { "label": "4", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "4" + } }, { "label": "5", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "newText": "5" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_dollar.snap index 6c9983c..5fe319d 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_dollar.snap @@ -9,7 +9,59 @@ expression: response "description": "i32" }, "kind": 6, - "insertText": "p" + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "$p" + } + }, + { + "label": "1", + "labelDetails": { + "description": "f32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "1" + } + }, + { + "label": "2", + "labelDetails": { + "description": "f64" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "2" + } }, { "label": "$l", @@ -17,6 +69,58 @@ expression: response "description": "i32" }, "kind": 6, - "insertText": "l" + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "$l" + } + }, + { + "label": "4", + "labelDetails": { + "description": "f32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "4" + } + }, + { + "label": "5", + "labelDetails": { + "description": "f64" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "5" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_ident.snap b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_ident.snap index 6c9983c..7572789 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_ident.snap @@ -9,7 +9,59 @@ expression: response "description": "i32" }, "kind": 6, - "insertText": "p" + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "$p" + } + }, + { + "label": "1", + "labelDetails": { + "description": "f32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "1" + } + }, + { + "label": "2", + "labelDetails": { + "description": "f64" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "2" + } }, { "label": "$l", @@ -17,6 +69,58 @@ expression: response "description": "i32" }, "kind": 6, - "insertText": "l" + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "$l" + } + }, + { + "label": "4", + "labelDetails": { + "description": "f32" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "4" + } + }, + { + "label": "5", + "labelDetails": { + "description": "f64" + }, + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "newText": "5" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_int_idx.snap b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_int_idx.snap index 084557c..5fe319d 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_int_idx.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_following_int_idx.snap @@ -8,41 +8,119 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "$p" + } }, { "label": "1", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "1" + } }, { "label": "2", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "2" + } }, { "label": "$l", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "$l" + } }, { "label": "4", "labelDetails": { "description": "f32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "4" + } }, { "label": "5", "labelDetails": { "description": "f64" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 19 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "newText": "5" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_in_different_funcs.snap b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_in_different_funcs.snap index 0a36981..933f987 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_in_different_funcs.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__locals_and_params_in_different_funcs.snap @@ -8,13 +8,39 @@ expression: response "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 19 + } + }, + "newText": "$p" + } }, { "label": "$l", "labelDetails": { "description": "i32" }, - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 19 + } + }, + "newText": "$l" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_call.snap b/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_call.snap index 5be5bae..1283c7c 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_call.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_call.snap @@ -10,7 +10,19 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "a" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 17 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "$a" + } }, { "label": "$b", @@ -19,7 +31,19 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "b" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 17 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "$b" + } }, { "label": "$c", @@ -28,7 +52,19 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "c" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 17 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "$c" + } }, { "label": "$d", @@ -37,6 +73,18 @@ expression: response }, "kind": 6, "sortText": "0", - "insertText": "d" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 17 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "$d" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_instr.snap b/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_instr.snap index 0af7d80..f8c3be6 100644 --- a/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_instr.snap +++ b/crates/service/tests/completion/snapshots/features__completion__local__preferred_type_by_instr.snap @@ -10,7 +10,19 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "a" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 18 + } + }, + "newText": "$a" + } }, { "label": "$b", @@ -19,7 +31,19 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "b" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 18 + } + }, + "newText": "$b" + } }, { "label": "$c", @@ -28,7 +52,19 @@ expression: response }, "kind": 6, "sortText": "0", - "insertText": "c" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 18 + } + }, + "newText": "$c" + } }, { "label": "$d", @@ -37,6 +73,18 @@ expression: response }, "kind": 6, "sortText": "1", - "insertText": "d" + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 18 + } + }, + "newText": "$d" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory.snap b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory.snap index 5907a8f..ef8df88 100644 --- a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory.snap +++ b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory.snap @@ -5,6 +5,19 @@ expression: response [ { "label": "$memory", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 22 + }, + "end": { + "line": 2, + "character": 23 + } + }, + "newText": "$memory" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_following_dollar.snap index cb2e815..47656bb 100644 --- a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_following_dollar.snap @@ -6,6 +6,18 @@ expression: response { "label": "$memory", "kind": 6, - "insertText": "memory" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 23 + }, + "end": { + "line": 2, + "character": 24 + } + }, + "newText": "$memory" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_incomplete.snap b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_incomplete.snap index cb2e815..f227d80 100644 --- a/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_incomplete.snap +++ b/crates/service/tests/completion/snapshots/features__completion__memory__export_desc_memory_incomplete.snap @@ -6,6 +6,18 @@ expression: response { "label": "$memory", "kind": 6, - "insertText": "memory" + "textEdit": { + "range": { + "start": { + "line": 2, + "character": 23 + }, + "end": { + "line": 2, + "character": 25 + } + }, + "newText": "$memory" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__elem_without_parens.snap b/crates/service/tests/completion/snapshots/features__completion__table__elem_without_parens.snap index 2bc4b1f..7c21719 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__elem_without_parens.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__elem_without_parens.snap @@ -13,6 +13,19 @@ expression: response "documentation": { "kind": "markdown", "value": "" + }, + "textEdit": { + "range": { + "start": { + "line": 3, + "character": 24 + }, + "end": { + "line": 3, + "character": 25 + } + }, + "newText": "$f" } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__export.snap b/crates/service/tests/completion/snapshots/features__completion__table__export.snap index 44318d3..84cc45a 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__export.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__export.snap @@ -5,10 +5,36 @@ expression: response [ { "label": "$table", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 19 + }, + "end": { + "line": 4, + "character": 20 + } + }, + "newText": "$table" + } }, { "label": "1", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 19 + }, + "end": { + "line": 4, + "character": 20 + } + }, + "newText": "1" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__export_following_int_index.snap b/crates/service/tests/completion/snapshots/features__completion__table__export_following_int_index.snap index 44318d3..74bf65f 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__export_following_int_index.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__export_following_int_index.snap @@ -5,10 +5,36 @@ expression: response [ { "label": "$table", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 20 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "newText": "$table" + } }, { "label": "1", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 4, + "character": 20 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "newText": "1" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__table_size.snap b/crates/service/tests/completion/snapshots/features__completion__table__table_size.snap index 44318d3..5cd6c5d 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__table_size.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__table_size.snap @@ -5,10 +5,36 @@ expression: response [ { "label": "$table", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 15 + }, + "end": { + "line": 5, + "character": 16 + } + }, + "newText": "$table" + } }, { "label": "1", - "kind": 6 + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 15 + }, + "end": { + "line": 5, + "character": 16 + } + }, + "newText": "1" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__table_size_following_dollar.snap b/crates/service/tests/completion/snapshots/features__completion__table__table_size_following_dollar.snap index d41682f..94b19da 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__table_size_following_dollar.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__table_size_following_dollar.snap @@ -6,6 +6,35 @@ expression: response { "label": "$table", "kind": 6, - "insertText": "table" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 17 + } + }, + "newText": "$table" + } + }, + { + "label": "1", + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 17 + } + }, + "newText": "1" + } } ] diff --git a/crates/service/tests/completion/snapshots/features__completion__table__table_size_incomplete_ident.snap b/crates/service/tests/completion/snapshots/features__completion__table__table_size_incomplete_ident.snap index d41682f..62ebf63 100644 --- a/crates/service/tests/completion/snapshots/features__completion__table__table_size_incomplete_ident.snap +++ b/crates/service/tests/completion/snapshots/features__completion__table__table_size_incomplete_ident.snap @@ -6,6 +6,35 @@ expression: response { "label": "$table", "kind": 6, - "insertText": "table" + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "$table" + } + }, + { + "label": "1", + "kind": 6, + "textEdit": { + "range": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 18 + } + }, + "newText": "1" + } } ]