-
Notifications
You must be signed in to change notification settings - Fork 817
Open
Labels
Domain: EditorRelated to the LSP server, editor experienceRelated to the LSP server, editor experience
Description
Extension Version
0.20260124.1
VS Code Version
1.108.2
Operating system Version
macOS 15.7
Steps to reproduce
I've written a failing fourslash test to demonstrate the issue:
package fourslash_test
import (
"testing"
"github.com/microsoft/typescript-go/internal/fourslash"
. "github.com/microsoft/typescript-go/internal/fourslash/tests/util"
"github.com/microsoft/typescript-go/internal/ls"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)
const TestAutoImportSymlinkedMonorepoSourceUpdateScenario = `
// @Filename: /home/src/workspaces/project/tsconfig.base.json
{
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"composite": true
}
}
// @Filename: /home/src/workspaces/project/packages/foo/package.json
{
"name": "@packages/foo",
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"default": "./dist/index.js"
}
}
}
// @Filename: /home/src/workspaces/project/packages/foo/tsconfig.json
{ "extends": "../../tsconfig.base.json" }
// @Filename: /home/src/workspaces/project/packages/foo/src/index.ts
/*fooEdit*/
// @Filename: /home/src/workspaces/project/packages/bar/package.json
{
"name": "@packages/bar",
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"default": "./dist/index.js"
}
}
"dependencies": {
"@packages/foo": "*"
}
}
// @Filename: /home/src/workspaces/project/packages/bar/tsconfig.json
{ "extends": "../../tsconfig.base.json" }
// @Filename: /home/src/workspaces/project/packages/bar/src/index.ts
/*fooCompletion*/
// @Filename: /home/src/workspaces/project/package.json
{ "workspaces": ["packages/*"], "type": "module" }
// @link: /home/src/workspaces/project/packages/bar -> /home/src/workspaces/project/node_modules/@packages/bar
// @link: /home/src/workspaces/project/packages/foo -> /home/src/workspaces/project/node_modules/@packages/foo
`
func TestAutoImportSymlinkedMonorepoSourceUpdate(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, TestAutoImportSymlinkedMonorepoSourceUpdateScenario)
defer done()
// force auto import to build the cache
f.BaselineAutoImportsCompletions(t, []string{"fooCompletion"})
// add the new function
f.GoToMarker(t, "fooEdit")
f.Insert(t, "\nexport function foo() {}")
// function should show up
f.VerifyCompletions(t, "fooCompletion", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
AdditionalTextEdits: fourslash.AnyTextEdits,
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
},
},
})
}I placed it at internal/fourslash/tests/autoImportSymlinkedMonorepoSourceUpdate_test.go.
Issue
It seems that the auto-import cache doesn't update for edits to symlinked workspace packages in a monorepo when types in a package.json points to the source Typescript. I would expect that it would, as this would make working in a monorepo pretty seamless for developers.
I'm happy to give more context about the related issues I've filed (#2581, and one in the Typescript repository) if that helps!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Domain: EditorRelated to the LSP server, editor experienceRelated to the LSP server, editor experience