Skip to content

Commit 7bfe3c9

Browse files
authoredFeb 8, 2025··
feat(completion): show only messages in bounced() and external() receivers (#124)
Fixes #123 Fixes #83
1 parent 2fb384e commit 7bfe3c9

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed
 

‎server/src/completion/CompletionContext.ts

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export class CompletionContext {
129129
const grand = parent.parent
130130
if (grand?.type === "bounced_function") {
131131
this.isBouncedMessage = true
132+
this.isMessageContext = true
132133
}
133134
}
134135

@@ -137,6 +138,9 @@ export class CompletionContext {
137138
if (grand?.type === "receive_function") {
138139
this.isMessageContext = true
139140
}
141+
if (grand?.type === "external_function") {
142+
this.isMessageContext = true
143+
}
140144
}
141145

142146
if (parent.type === "tlb_serialization") {

‎server/src/e2e/suite/testcases/completion/messages.test

+17-6
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,21 @@ contract Foo {
4848
}
4949
------------------------------------------------------------------------
5050
13 bounced<Type>
51-
13 map<K, V>
52-
9 Address
53-
9 Int
54-
9 String
5551
21 Bar
56-
21 Foo
57-
24 Var
52+
53+
========================================================================
54+
Completion in external function
55+
========================================================================
56+
primitive Int;
57+
primitive Address;
58+
primitive String;
59+
60+
struct Foo {}
61+
message Bar {}
62+
trait Var {}
63+
64+
contract Foo {
65+
external(msg: <caret>) {}
66+
}
67+
------------------------------------------------------------------------
68+
21 Bar

0 commit comments

Comments
 (0)