Skip to content

Commit 1170944

Browse files
jojCopilot
andauthored
fix(workspace/symbol): use name span in ProvideWorkspaceSymbols (#3836)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 401d27a commit 1170944

15 files changed

Lines changed: 59 additions & 74 deletions

internal/fourslash/_scripts/manualTests.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ linkedEditingJsxTag5
8888
linkedEditingJsxTag6
8989
linkedEditingJsxTag7
9090
linkedEditingJsxTag9
91+
navigateItemsLet
92+
navigateToImport
93+
navigateToSymbolIterator
9194
navigationBarFunctionPrototype
9295
navigationBarFunctionPrototype2
9396
navigationBarFunctionPrototype3
@@ -97,9 +100,13 @@ navigationBarFunctionPrototypeInterlaced
97100
navigationBarFunctionPrototypeNested
98101
navigationBarJsDoc
99102
navigationItemsExactMatch2
103+
navigationItemsInConstructorsExactMatch
104+
navigationItemsPrefixMatch2
100105
navigationItemsSpecialPropertyAssignment
106+
navto_emptyPattern
101107
navto_excludeLib1
102108
navto_excludeLib2
109+
navto_excludeLib3
103110
navto_excludeLib4
104111
navto_serverExcludeLib
105112
nodeModulesImportCompletions1

internal/fourslash/tests/gen/navigateItemsLet_test.go renamed to internal/fourslash/tests/manual/navigateItemsLet_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navigateItemsLet"
3-
41
package fourslash_test
52

63
import (
@@ -12,13 +9,12 @@ import (
129
)
1310

1411
func TestNavigateItemsLet(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @noLib: true
19-
let [|c = 10|];
15+
let [|c|] = 10;
2016
function foo() {
21-
let [|d = 10|];
17+
let [|d|] = 10;
2218
}`
2319
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2420
defer done()

internal/fourslash/tests/gen/navigateToImport_test.go renamed to internal/fourslash/tests/manual/navigateToImport_test.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navigateToImport"
3-
41
package fourslash_test
52

63
import (
@@ -12,15 +9,14 @@ import (
129
)
1310

1411
func TestNavigateToImport(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @lib: es5
1915
// @Filename: library.ts
20-
[|export function foo() {}|]
21-
[|export function bar() {}|]
16+
export function [|foo|]() {}
17+
export function [|bar|]() {}
2218
// @Filename: user.ts
23-
import {foo, [|bar as baz|]} from './library';`
19+
import {foo, bar as [|baz|]} from './library';`
2420
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2521
defer done()
2622
f.VerifyWorkspaceSymbol(t, []*fourslash.VerifyWorkspaceSymbolCase{

internal/fourslash/tests/gen/navigateToSymbolIterator_test.go renamed to internal/fourslash/tests/manual/navigateToSymbolIterator_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navigateToSymbolIterator"
3-
41
package fourslash_test
52

63
import (
@@ -12,12 +9,11 @@ import (
129
)
1310

1411
func TestNavigateToSymbolIterator(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @lib: es5
1915
class C {
20-
[|[Symbol.iterator]() {}|]
16+
[|[Symbol.iterator]|]() {}
2117
}`
2218
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2319
defer done()

internal/fourslash/tests/manual/navigationItemsExactMatch2_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ func TestNavigationItemsExactMatch2(t *testing.T) {
1313

1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `module Shapes {
16-
[|class Point {
17-
[|private _origin = 0.0;|]
18-
[|private distanceFromA = 0.0;|]
16+
class [|Point|] {
17+
private [|_origin|] = 0.0;
18+
private [|distanceFromA|] = 0.0;
1919
20-
[|get distance1(distanceParam): number {
20+
get [|distance1|](distanceParam): number {
2121
var [|distanceLocal|];
2222
return 0;
23-
}|]
24-
}|]
23+
}
24+
}
2525
}
2626
27-
var [|point = new Shapes.Point()|];
28-
[|function distance2(distanceParam1): void {
27+
var [|point|] = new Shapes.Point();
28+
function [|distance2|](distanceParam1): void {
2929
var [|distanceLocal1|];
30-
}|]`
30+
}`
3131
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
3232
defer done()
3333
f.VerifyWorkspaceSymbol(t, []*fourslash.VerifyWorkspaceSymbolCase{

internal/fourslash/tests/gen/navigationItemsInConstructorsExactMatch_test.go renamed to internal/fourslash/tests/manual/navigationItemsInConstructorsExactMatch_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navigationItemsInConstructorsExactMatch"
3-
41
package fourslash_test
52

63
import (
@@ -12,13 +9,12 @@ import (
129
)
1310

1411
func TestNavigationItemsInConstructorsExactMatch(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @noLib: true
1915
class Test {
20-
[|private search1: number;|]
21-
constructor([|public search2: boolean|], [|readonly search3: string|], search4: string) {
16+
private [|search1|]: number;
17+
constructor(public [|search2|]: boolean, readonly [|search3|]: string, search4: string) {
2218
}
2319
}`
2420
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)

internal/fourslash/tests/gen/navigationItemsPrefixMatch2_test.go renamed to internal/fourslash/tests/manual/navigationItemsPrefixMatch2_test.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navigationItemsPrefixMatch2"
3-
41
package fourslash_test
52

63
import (
@@ -12,29 +9,28 @@ import (
129
)
1310

1411
func TestNavigationItemsPrefixMatch2(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @lib: es5
1915
namespace Shapes {
2016
export class Point {
21-
[|private originality = 0.0;|]
22-
[|private distanceFromOrig = 0.0;|]
23-
[|get distanceFarFarAway(distanceFarFarAwayParam: number): number {
17+
private [|originality|] = 0.0;
18+
private [|distanceFromOrig|] = 0.0;
19+
get [|distanceFarFarAway|](distanceFarFarAwayParam: number): number {
2420
var [|distanceFarFarAwayLocal|];
2521
return 0;
26-
}|]
22+
}
2723
}
2824
}
2925
var pointsSquareBox = new Shapes.Point();
3026
function PointsFunc(): void {
3127
var pointFuncLocal;
3228
}
33-
[|interface OriginI {
29+
interface [|OriginI|] {
3430
123;
35-
[|origin1;|]
36-
[|public _distance(distanceParam): void;|]
37-
}|]`
31+
[|origin1|];
32+
public [|_distance|](distanceParam): void;
33+
}`
3834
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
3935
defer done()
4036
f.VerifyWorkspaceSymbol(t, []*fourslash.VerifyWorkspaceSymbolCase{

internal/fourslash/tests/manual/navigationItemsSpecialPropertyAssignment_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ func TestNavigationItemsSpecialPropertyAssignment(t *testing.T) {
1515
const content = `// @noLib: true
1616
// @allowJs: true
1717
// @Filename: /a.js
18-
[|exports.x = 0|];
19-
[|exports.z = function() {}|];
18+
exports.[|x|] = 0;
19+
exports.[|z|] = function() {};
2020
function Cls() {
21-
[|this.instanceProp = 0|];
21+
this.[|instanceProp|] = 0;
2222
}
23-
[|Cls.staticMethod = function() {}|];
24-
[|Cls.staticProperty = 0|];
25-
[|Cls.prototype.instanceMethod = function() {}|];`
23+
Cls.[|staticMethod|] = function() {};
24+
Cls.[|staticProperty|] = 0;
25+
Cls.prototype.[|instanceMethod|] = function() {};`
2626
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2727
defer done()
2828
f.VerifyWorkspaceSymbol(t, []*fourslash.VerifyWorkspaceSymbolCase{

internal/fourslash/tests/gen/navto_emptyPattern_test.go renamed to internal/fourslash/tests/manual/navto_emptyPattern_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Code generated by convertFourslash; DO NOT EDIT.
2-
// To modify this test, run "npm run makemanual navto_emptyPattern"
3-
41
package fourslash_test
52

63
import (
@@ -12,12 +9,11 @@ import (
129
)
1310

1411
func TestNavto_emptyPattern(t *testing.T) {
15-
fourslash.SkipIfFailing(t)
1612
t.Parallel()
1713
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1814
const content = `// @filename: foo.ts
19-
const [|x: number = 1|];
20-
[|function y(x: string): string { return x; }|]`
15+
const [|x|]: number = 1;
16+
function [|y|](x: string): string { return x; }`
2117
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2218
defer done()
2319
f.VerifyWorkspaceSymbol(t, []*fourslash.VerifyWorkspaceSymbolCase{

internal/fourslash/tests/manual/navto_excludeLib1_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ func TestNavto_excludeLib1(t *testing.T) {
1616
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1717
const content = `// @filename: /index.ts
1818
import { weirdName as otherName } from "bar";
19-
const [|weirdName: number = 1|];
19+
const [|weirdName|]: number = 1;
2020
// @filename: /tsconfig.json
2121
{}
2222
// @filename: /node_modules/bar/index.d.ts
23-
export const [|weirdName: number|];
23+
export const [|weirdName|];
2424
// @filename: /node_modules/bar/package.json
2525
{}`
2626
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)

0 commit comments

Comments
 (0)