Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions internal/fourslash/tests/documentHighlightImportPath_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestDocumentHighlightImportPath(t *testing.T) {
t.Parallel()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /a.d.ts
declare module "my-module" {
export const foo: number;
}

// @Filename: /b.ts
import { foo } from "[|my-module|]";`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyBaselineDocumentHighlights(t, nil /*preferences*/, f.Ranges()[0])
}
2 changes: 1 addition & 1 deletion internal/ls/findallreferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit
}

moduleReferences := l.getReferencedSymbolsForModuleIfDeclaredBySourceFile(ctx, symbol, program, sourceFiles, checker, options, sourceFilesSet) // !!! cancellationToken
if moduleReferences != nil && symbol.Flags&ast.SymbolFlagsTransient != 0 {
if moduleReferences != nil && symbol.Flags&ast.SymbolFlagsTransient == 0 {
return moduleReferences
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// === documentHighlights ===
// === /b.ts ===
// import { foo } from "/*HIGHLIGHTS*/my-module";