File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
} from "./server" ;
14
14
import {
15
15
CompletionItem ,
16
+ CompletionItemKind ,
16
17
Hover ,
17
18
MarkupContent ,
18
19
Range ,
@@ -197,11 +198,11 @@ result
197
198
} ) ;
198
199
199
200
it ( "should provide pattern match completions" , ( ) => {
200
- const position = { line : 10 , character : 4 } ; // After "|"
201
+ const position = { line : 12 , character : 4 } ; // After "|"
201
202
const completions = getCompletionItems ( document , position ) ;
202
203
203
204
const patternCompletions = completions . filter (
204
- ( c ) => c . kind === 14 && c . label . includes ( "->" ) , // Snippet kind
205
+ ( c ) => c . kind === CompletionItemKind . Snippet && c . insertText ? .includes ( "->" ) , // Snippet kind
205
206
) ;
206
207
expect ( patternCompletions . length ) . toBeGreaterThan ( 0 ) ;
207
208
} ) ;
Original file line number Diff line number Diff line change @@ -677,19 +677,19 @@ function analyzeCompletionContext(
677
677
return { type : "tag" } ;
678
678
}
679
679
680
- // Check for where clause context
681
- if ( lineText . trim ( ) . startsWith ( ";" ) || findParentOfType ( node , "where" ) ) {
682
- return { type : "where_clause" } ;
683
- }
684
-
685
680
// Check for pattern match context
686
681
if (
687
682
lineText . trim ( ) . startsWith ( "|" ) ||
688
- findParentOfType ( node , "pattern_match " )
683
+ findParentOfType ( node , "match_fun " )
689
684
) {
690
685
return { type : "pattern_match" } ;
691
686
}
692
687
688
+ // Check for where clause context
689
+ if ( lineText . trim ( ) . startsWith ( ";" ) || findParentOfType ( node , "where" ) ) {
690
+ return { type : "where_clause" } ;
691
+ }
692
+
693
693
// Check for record field access
694
694
if ( lineText . includes ( "." ) || parent ?. type === "record_access" ) {
695
695
return { type : "record_field" } ;
You can’t perform that action at this time.
0 commit comments