Skip to content

Commit 0546a76

Browse files
fix: Fix bug signature help
1 parent 552c79a commit 0546a76

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

internal/handler/signature_help_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type signatureHelpTestCase struct {
2020

2121
var signatureHelpTestCases = []signatureHelpTestCase{
2222
// single record
23-
// input is "insert into city (ID, Name, CountryCode) VALUES (123, 'aaa', '2020')"
23+
// input is "insert into city (ID, Name, CountryCode) VALUES (123, NULL, '2020')"
2424
genSingleRecordInsertTest(50, 0),
2525
genSingleRecordInsertTest(52, 0),
2626
genSingleRecordInsertTest(53, 1),
@@ -48,7 +48,7 @@ var signatureHelpTestCases = []signatureHelpTestCase{
4848
func genSingleRecordInsertTest(col int, wantActiveParameter int) signatureHelpTestCase {
4949
return signatureHelpTestCase{
5050
name: fmt.Sprintf("single record %d-%d", col, wantActiveParameter),
51-
input: "insert into city (ID, Name, CountryCode) VALUES (123, 'aaa', '2020')",
51+
input: "insert into city (ID, Name, CountryCode) VALUES (123, NULL, '2020')",
5252
line: 0,
5353
col: col,
5454
want: lsp.SignatureHelp{

parser/parser.go

+3
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,9 @@ var identifierListTargetMatcher = astutil.NodeMatcher{
550550
ast.TypeOperator,
551551
ast.TypeSwitchCase,
552552
},
553+
ExpectKeyword: []string{
554+
"NULL",
555+
},
553556
}
554557

555558
func parseIdentifierList(reader *astutil.NodeReader) ast.Node {

parser/parser_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,15 @@ func TestParseIdentifierList(t *testing.T) {
983983
testIdentifierList(t, list[0], input)
984984
},
985985
},
986+
{
987+
name: "with null",
988+
input: "foo, null, foobar",
989+
checkFn: func(t *testing.T, stmts []*ast.Statement, input string) {
990+
testStatement(t, stmts[0], 1, input)
991+
list := stmts[0].GetTokens()
992+
testIdentifierList(t, list[0], input)
993+
},
994+
},
986995
{
987996
name: "invalid single identifer without whitespace",
988997
input: "foo,",

0 commit comments

Comments
 (0)