Closed sweiss3 closed 3 years ago
What do you mean by not having Intellisense? Does any IntelliSense work, or is only cross-file Intellisense broken?
Sorry, I'll try to clarify - it will not identify full paths, but works with relative ones.
So this would work as expected (1):
import { Something } from "./MyImportFile";
But the following would complain about the entire path not existing (2):
import { Something } from "ClientRoot/SomeFolder/MyImportFile";
After restarting VS code, (2) is also identified and working properly.
Can you please share a small example project that demonstrates the issue? For example, what does the tsconfig look like?
I've created a repository to demonstrate the issue, you can clone it from here: https://github.com/sweiss3/vscode-116019-sample
There's also a readme depicting the exact scenario - and the issue happens when using symbolic links. I'm aware of the situation being quite obscure, but I'm afraid that's the setup my team is using :)
Copy-pasting the README here for convenience:
After cloning the repository, run setup.cmd (on Windows)
This will create a directory junction from Folder2 to Client\LinkToFolder2. Client\LinkToFolder2 is in .gitignore (as it's linking to a different place in the repository, so you don't want to have the same files twice)
Open VSCode Navigate to Client\LinkToFolder2 and open Module2.ts
You will see the import statement is valid. However, if you are to create a new file - Module3.ts right next to it, and add the exact same import statement - VSCode will complain that it cannot find the import.
If you restart VSCode and navigate back to Module3.ts, it will be just fine.
Thanks @sweiss3!
Looks like the new file ends up in different projects. TS Server log:
@sheetalkamat this looks like a duplicate of the symlink issue we discussed last week, can you dupe?
@mjbvz let's talk about symlinked paths next week at sync
Looked at this and in this example the root cause isnt similar to #37630 which is what @RyanCavanaugh and myself discussed last week. What happens here is that the directory watcher isn't invoked for the LinkedFolder2 but Folder2. So when this happens our cache of directory structure is only invalidated for Folder2 but not LinkedFolder2 which where it isnt aware of file Module3 in that folder so seems like something we probably can handle in cache which need to be investigated. Probably fix for this would to not cache directory structures for symlinked folders.
Note that root files for this project are picked up LinkedFolder2 and not the actual disk location.
Info 298 [12:21:38.930] DirectoryWatcher:: Triggered with c:/temp/vscode-116019-sample/folder2/Module3.ts :: WatchInfo: c:/temp/vscode-116019-sample/folder2 1 undefined Project: c:/temp/vscode-116019-sample/tsconfig.json WatchType: Wild card directory
Info 299 [12:21:38.931] Scheduled: c:/temp/vscode-116019-sample/tsconfig.json
Info 300 [12:21:38.931] Scheduled: *ensureProjectForOpenFiles*
Info 301 [12:21:38.931] Elapsed:: 1.0710999965667725ms DirectoryWatcher:: Triggered with c:/temp/vscode-116019-sample/folder2/Module3.ts :: WatchInfo: c:/temp/vscode-116019-sample/folder2 1 undefined Project: c:/temp/vscode-116019-sample/tsconfig.json WatchType: Wild card directory
I'm facing what appears to be the same problem - TS version 5.1.6, VS code version is 1.90.1. I have a Remix project with a tsconfig.json file at its root. Inside its /app
folder is a plugins folder, which is gitignored and contains symlinks to other modules of the codebase. If I create a new file inside one of those symlinked directories, I get no autocomplete or Intellisense recommendations for imports, and any JSX gives me a Cannot find name React
. If I mouse over the Typescript config at the bottom right of VS Code, it correctly detects the Typescript version from the Remix project's node_modules
folder, but indicates that there is no tsconfig.json
file. If I restart the Typescript server, the issue is resolved - the tsconfig.json
file is detected correctly, the JSX errors go away, and imports work as expected.
Please open a new issue after testing against latest (TypeScript 5.5). This issue is over three years old.
Issue Type: Bug TS Template added by @mjbvz
TypeScript Version: 4.2.0-insiders.20210210
Search Terms
The new file won't have intellisense and it will not recognize any import statements to paths as configured in tsconfig.json.
Restarting VSCode and navigating back to the same file will get it to work properly.
VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:34:46.910Z) OS version: Windows_NT x64 10.0.19042
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz (16 x 2400)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|63.73GB (44.83GB free)| |Process Argv|C:\\Rome-Defenders-Extension\\ExtTemplate\\..\\workspace.code-workspace --crash-reporter-id 36147b9c-7d35-4c17-8dd9-d36495a17db2| |Screen Reader|no| |VM|0%|
Extensions (9)
Extension|Author (truncated)|Version ---|---|--- bracket-pair-colorizer|Coe|1.0.61 vscode-eslint|dba|2.1.14 make-hidden|dev|3.0.3 gitlens|eam|11.1.3 tslint|eg2|1.0.44 powershell|ms-|2020.6.0 autolaunch|phi|2.0.3 code-spell-checker|str|1.10.2 vscode-icons|vsc|11.1.0 (1 theme extensions excluded)A/B Experiments
``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30211402 vstry244cf:30250196 pythonvsdeb440:30248342 pythonvsded773:30248341 pythonvspyt875:30251590 ```