Skip to content

Commit ae84521

Browse files
committed
fix broken error message and nil formatcodesettings pointer
1 parent c105023 commit ae84521

File tree

32 files changed

+24
-199
lines changed

32 files changed

+24
-199
lines changed

internal/fourslash/_scripts/failingTests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ TestCompletionForStringLiteralNonrelativeImport2
9898
TestCompletionForStringLiteralNonrelativeImport3
9999
TestCompletionForStringLiteralNonrelativeImport4
100100
TestCompletionForStringLiteralNonrelativeImport8
101+
TestCompletionForStringLiteralNonrelativeImport9
101102
TestCompletionForStringLiteralNonrelativeImportTypings1
102103
TestCompletionForStringLiteralNonrelativeImportTypings2
103104
TestCompletionForStringLiteralNonrelativeImportTypings3

internal/fourslash/fourslash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ func (f *FourslashTest) writeMsg(t *testing.T, msg *lsproto.Message) {
631631
}
632632

633633
func sendRequest[Params, Resp any](t *testing.T, f *FourslashTest, info lsproto.RequestInfo[Params, Resp], params Params) Resp {
634-
// t.Helper()
634+
t.Helper()
635635
prefix := f.getCurrentPositionPrefix()
636636
f.baselineState(t)
637637
f.baselineRequestOrNotification(t, info.Method, params)

internal/ls/lsutil/userpreferences.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ func (p *UserPreferences) ParseWorker(config map[string]any) *UserPreferences {
382382
// unstable properties must be named the same as userPreferences
383383
p.parseAll(unstable)
384384
}
385-
formatSettingsParsed := false
386385
for name, values := range config {
387386
switch name {
388387
case "unstable":
@@ -400,7 +399,7 @@ func (p *UserPreferences) ParseWorker(config map[string]any) *UserPreferences {
400399
case "workspaceSymbols":
401400
p.parseWorkspaceSymbols(values)
402401
case "format":
403-
formatSettingsParsed = p.FormatCodeSettings.Parse(values) || formatSettingsParsed
402+
p.FormatCodeSettings.Parse(values)
404403
case "tsserver":
405404
// !!!
406405
case "tsc":
@@ -409,12 +408,9 @@ func (p *UserPreferences) ParseWorker(config map[string]any) *UserPreferences {
409408
// !!!
410409
default:
411410
p.Set(name, values)
412-
formatSettingsParsed = p.FormatCodeSettings.Set(name, values) || formatSettingsParsed
411+
p.FormatCodeSettings.Set(name, values)
413412
}
414413
}
415-
if !formatSettingsParsed {
416-
p.FormatCodeSettings = nil
417-
}
418414
return p
419415
}
420416

internal/scanner/scanner.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,9 +2346,8 @@ func getErrorRangeForArrowFunction(sourceFile *ast.SourceFile, node *ast.Node) c
23462346
startLine := GetECMALineOfPosition(sourceFile, body.Pos())
23472347
endLine := GetECMALineOfPosition(sourceFile, body.End())
23482348
if startLine < endLine {
2349-
// The arrow function spans multiple lines,
2350-
// make the error span be the first line, inclusive.
2351-
return core.NewTextRange(pos, GetECMAEndLinePosition(sourceFile, startLine))
2349+
// The arrow function spans multiple lines, make the error span be the first line, inclusive.
2350+
return core.NewTextRange(pos, GetECMAEndLinePosition(sourceFile, startLine)+1)
23522351
}
23532352
}
23542353
return core.NewTextRange(pos, node.End())

testdata/baselines/reference/submodule/compiler/arrowFunctionErrorSpan.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => num
3232

3333
// multiline, body
3434
f(() => {
35-
~~~~~~
35+
~~~~~~~
3636
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
3737
!!! error TS2345: Type 'void' is not assignable to type 'number'.
3838

3939
});
4040

4141
// multiline 2, body
4242
f(() => {
43-
~~~~~~
43+
~~~~~~~
4444
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
4545
!!! error TS2345: Type 'void' is not assignable to type 'number'.
4646

@@ -85,7 +85,7 @@ arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => num
8585
// multi line with a comment 2
8686
f(/*
8787
*/() => {
88-
~~~~~~~
88+
~~~~~~~~
8989
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
9090
!!! error TS2345: Type 'void' is not assignable to type 'number'.
9191

@@ -95,7 +95,7 @@ arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => num
9595
f( // comment 1
9696
// comment 2
9797
() =>
98-
~~~~
98+
~~~~~
9999
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
100100
!!! error TS2345: Type 'void' is not assignable to type 'number'.
101101
// comment 3

testdata/baselines/reference/submodule/compiler/arrowFunctionErrorSpan.errors.txt.diff

Lines changed: 0 additions & 38 deletions
This file was deleted.

testdata/baselines/reference/submodule/compiler/asyncFunctionNoReturnType.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ asyncFunctionNoReturnType.ts(1,1): error TS2705: An async function or method in
55
!!! error TS2468: Cannot find global value 'Promise'.
66
==== asyncFunctionNoReturnType.ts (1 errors) ====
77
async () => {
8-
~~~~~~~~~~~~
8+
~~~~~~~~~~~~~
99
!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
1010
if (window)
1111
return;

testdata/baselines/reference/submodule/compiler/asyncFunctionNoReturnType.errors.txt.diff

Lines changed: 0 additions & 11 deletions
This file was deleted.

testdata/baselines/reference/submodule/compiler/contextualTupleTypeParameterReadonly.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contextualTupleTypeParameterReadonly.ts(10,8): error TS2345: Argument of type '(
1515
const eacher = each(cases);
1616

1717
eacher((a, b) => {
18-
~~~~~~~~~~
18+
~~~~~~~~~~~
1919
!!! error TS2345: Argument of type '(a: 1 | 2, b: "1" | "2") => void' is not assignable to parameter of type '(...args: readonly [1, "1"] | readonly [2, "2"]) => any'.
2020
!!! error TS2345: Types of parameters 'a' and 'args' are incompatible.
2121
!!! error TS2345: Type 'readonly [1, "1"] | readonly [2, "2"]' is not assignable to type '[a: 1 | 2, b: "1" | "2"]'.

testdata/baselines/reference/submodule/compiler/contextualTupleTypeParameterReadonly.errors.txt.diff

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)