mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 02:08:17 +00:00
fix: forbid ident code completion in field access (#1020)
* feat: forbid ident code completion in field access * test: update snapshot
This commit is contained in:
parent
142138297e
commit
0f512dd09e
3 changed files with 5 additions and 24 deletions
|
@ -8,27 +8,6 @@ snapshot_kind: text
|
|||
[
|
||||
{
|
||||
"isIncomplete": false,
|
||||
"items": [
|
||||
{
|
||||
"kind": 3,
|
||||
"label": "text",
|
||||
"labelDetails": {
|
||||
"description": "(content, str, alternates: bool, baseline: length, bottom-edge: \"baseline\" | \"bounds\" | \"descender\" | length, cjk-latin-spacing: auto | none, costs: dictionary, dir: dir, discretionary-ligatures: bool, fallback: bool, features: array | dictionary, fill: color, font: array | text.font, fractions: bool, historical-ligatures: bool, hyphenate: auto | bool, kerning: bool, lang: text.lang, ligatures: bool, number-type: \"lining\" | \"old-style\" | auto, number-width: \"proportional\" | \"tabular\" | auto, overhang: bool, region: text.region, script: auto | str, size: text.size, slashed-zero: bool, spacing: relative, stretch: ratio, stroke: stroke, style: \"italic\" | \"normal\" | \"oblique\", stylistic-set: array | int | none, top-edge: \"ascender\" | \"baseline\" | \"bounds\" | \"cap-height\" | \"x-height\" | length, tracking: length, weight: \"black\" | \"bold\" | \"extrabold\" | \"extralight\" | \"light\" | \"medium\" | \"regular\" | \"semibold\" | \"thin\" | int) => text"
|
||||
},
|
||||
"textEdit": {
|
||||
"newText": "text(${1:}), ",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 71,
|
||||
"line": 2
|
||||
},
|
||||
"start": {
|
||||
"character": 70,
|
||||
"line": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"items": []
|
||||
}
|
||||
]
|
||||
|
|
|
@ -526,7 +526,9 @@ fn complete_code(ctx: &mut CompletionContext, from_type: bool) -> bool {
|
|||
}
|
||||
|
||||
// An existing identifier: "{ pa| }".
|
||||
if ctx.leaf.kind() == SyntaxKind::Ident {
|
||||
if ctx.leaf.kind() == SyntaxKind::Ident
|
||||
&& !matches!(ctx.leaf.parent_kind(), Some(SyntaxKind::FieldAccess))
|
||||
{
|
||||
ctx.from = ctx.leaf.offset();
|
||||
code_completions(ctx, false);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue