-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lsp: JSDoc imports not recognised #13156
Comments
It seems like something is going wrong inside the tsc code. I've debugged the deno process and as far as I can tell, when hovering over a jsdoc import, deno is simply requesting |
Alright I'm on to something. I can't seem to set breakpoints though, so it's hard to figure out where it's being set to undefined. |
I've added the following to let mut ts_runtime = load().expect("could not load tsc");
let inspector = ts_runtime.inspector();
inspector.create_local_session();
inspector.wait_for_session_and_break_on_next_statement();
let server = Arc::new(InspectorServer::new("127.0.0.1:9229".parse().unwrap(), version::get_user_agent()));
server.register_inspector(
"deno:cli/tsc/99_main_compiler.js".to_string(),
&mut ts_runtime,
false,
); so that I can inspect the typescript language server. But I'm unable to place breakpoints. This makes it next to impossible to figure out why the script isn't loaded. If anyone has any idea of either:
that'd be really helpful. Because I'm out of ideas. |
@jespertheend are you able to connect to the inspector of compiler isolate correctly? Could you record a gif showing what's going on? |
Trying to debug the isolate is complicated, and it is likely to get much better results by running a specific test with the If there isn't sufficient logging in the |
I've managed to find a codepath in deno's source code that differs between But fwiw this is what's currently happening: Screen.Recording.2021-12-20.at.22.36.50.mp4.mp4The inspector websocket messages only get handled when the lsp is being used, which is to be expected as they're both on the same thread. But I don't get why breakpoints don't work. I've managed to pin it down to But none of the files match. Is a module loader required in order for breakpoints to work? As far as I can tell that's the only difference between the inspector for |
Hmm ok I think I got it. But the issue lies deeper than I had hoped. This calls into swc code so I'm afraid it's a missing feature from swc. |
Lines 1025 to 1059 in 1eb7873
This is where it goes wrong. Because the dependencies list is empty, it fails to resolve the imported module. import {Bar} from "./Bar.js";
/** @type {import("./Bar.js").Bar} */
const foo = null; |
Ok, thanks for isolating it. It is a problem with |
We need to enhance |
I think I have a fix that might be easier. All tests seem to pass but I'm not sure if this causes any imports to resolve even though they shouldn't. |
@jespertheend as I stated in the PR, it won't work for remote modules. We need to information in module graph. |
I just found out this duplicates #11362 |
Thanks so much for this @kitsonk! I'm pretty much only using js files with jsdoc imports all over the place. So without this the Deno extension was basically unusable for me. |
Describe the bug
When the deno extension is enabled, typed imports via
/** @type {import("...
stop working.To Reproduce
Bar.js
:Foo.js
:foo
and note it's type is set toBar
.Deno: Initialize Workspace Configuration
foo
again.Expected behavior
The type remains set to
Bar
, rather thanany
.Screenshots
If applicable, add screenshots to help explain your problem.
Versions
vscode: 1.62.3 deno: 1.16.3 extension: 3.9.2
The text was updated successfully, but these errors were encountered: