Skip to content
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: not resolving extending interfaces with import map #10439

Closed
darkdamp opened this issue Apr 23, 2021 · 6 comments · Fixed by #11496 or javascript-indonesias/deno#82
Closed

lsp: not resolving extending interfaces with import map #10439

darkdamp opened this issue Apr 23, 2021 · 6 comments · Fixed by #11496 or javascript-indonesias/deno#82
Assignees
Labels
bug Something isn't working correctly lsp related to the language server

Comments

@darkdamp
Copy link

There seem to be an issue with extending interfaces not resolving sometimes.

I open my workplace in vscode and enter file a.ts and it doesn't detect the interface extending Context from oak
image

But when just 'entering' the file which returns the interface that extends Context. It gets resolved
image

And it now works if I tab back to a.ts
image

If this is not a bug, I'd appreciate any pointer on how to 'load' all files in a workplace to resolve the intellisense at startup

.vscode/settings.json

{
    "deno.enable": true,
    "deno.importMap": "./import_map.json",
    "deno.config": "./tsconfig.json",
    "deno.unstable": true
 }

vscode: 1.55.2
deno: 1.9.2
extension: 3.3.0

Thanks

@kitsonk
Copy link
Contributor

kitsonk commented Apr 23, 2021

Can you provide how you are importing IWebGetContext into a.ts?

@darkdamp
Copy link
Author

darkdamp commented Apr 23, 2021

I use an import_map.json but it's a local file imported like this @kitsonk
import { IWebGetContext } from 'Web/Interfaces/IWebContext.ts'

@kitsonk
Copy link
Contributor

kitsonk commented Apr 23, 2021

And I assume Web/Interfaces/IWebContext.ts resolves to the module that you then open where the extension happens?

It should work, I am not sure why it isn't... could be something to do with how the language server is handling the import map internally.

@darkdamp
Copy link
Author

I commented out "deno.importMap": "./import_map.json" from settings.json and edited the import to import { IWebGetContext } from '../Interfaces/IWebContext.ts'; and still get the same error as above. Until I open the file that is.

I'm on windows 10 if that makes a difference

@darkdamp
Copy link
Author

darkdamp commented Apr 24, 2021

@kitsonk I've figured out how to trigger it. An import map works for local files (like in the first image below) but external modules need to load from it's URL or else you get the error above on load. So below works on-load if I use oak from it's URL but if I use oak/mod.ts through an import map with "oak/": "https://deno.land/x/oak/" I need to 'open' the file in the editor for it to register.

Works
image

image

Error
image

image

@darkdamp
Copy link
Author

darkdamp commented Apr 24, 2021

@kitsonk Here's another use case with purely local modules that triggers the same when extending an interface. Using import map and ctx is ctx: IMain

image

image

image

And if I enter the file IExtend.ts it resolves in the Controller class

@kitsonk kitsonk self-assigned this Apr 25, 2021
@kitsonk kitsonk transferred this issue from denoland/vscode_deno Apr 30, 2021
@kitsonk kitsonk changed the title Editor not resolving extending interfaces lsp: not resolving extending interfaces with import map Apr 30, 2021
@kitsonk kitsonk added bug Something isn't working correctly lsp related to the language server labels Apr 30, 2021
kitsonk added a commit that referenced this issue Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly lsp related to the language server
Projects
None yet
2 participants