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

ts definitions on javascript file not working #129

Open
brunobmello25 opened this issue Jan 12, 2024 · 7 comments
Open

ts definitions on javascript file not working #129

brunobmello25 opened this issue Jan 12, 2024 · 7 comments

Comments

@brunobmello25
Copy link

This happens when working with some nodejs libraries in a js project. Steps to reproduce:

npm init -y
npm install @slack/bolt
touch main.js

now open main.js and import App from slack bolt

const { App } = require("@slack/bolt")

const app = new App({
  ... // try to get intellisense here
})

When using tsserver this gives us proper type definitions for all properties, but when using with vtsls we get nothing.

@brunobmello25
Copy link
Author

I don't have much experience with lsp's (never wrote anything related to it, just used them) but I'd be glad to try helping solving this . Let me know if you need anything

@yioneko
Copy link
Owner

yioneko commented Jan 14, 2024

Could you check if other LSP features like hover doc work normally? Does the basic completion for keywords like import and const also not work? LSP log from the client could make it easier for troubleshooting.

@brunobmello25
Copy link
Author

yep, basic keywords completion work normally:
image

Hover docs also work, it's just type definitions that aren't working properly.
image

My lsp logs don't seem to have any relevant information regarding vtsls:

[START][2024-01-14 23:28:38] LSP logging initiated
[WARN][2024-01-14 23:28:38] ...lsp/handlers.lua:134     "The language server copilot triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"

@brunobmello25
Copy link
Author

I might have failed to explain the problem more clearly: lsp features are working fine, but when using vtsls with javascript files specifically (not typescript files) there are no type definitions.

@yioneko
Copy link
Owner

yioneko commented Jan 15, 2024

I think this is the same issue: microsoft/vscode#196554, should be fixed in HEAD (not released yet).

You can set moduleResolution to Node in your tsconfig.json to temporarily solve this.

@brunobmello25
Copy link
Author

I don't really have a tsconfig file since it's a js only project =/ But I'll see if I can figure something else out. Thanks!

One other thing: I tested opening up vscode on the same project here and in vscode the type definitions are loading file, at least in vscode 1.85.1 (commit 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2)

Maybe vtsls is using an older lsp version than what this vscode version uses?

@yioneko
Copy link
Owner

yioneko commented Jan 15, 2024

Maybe vtsls is using an older lsp version than what this vscode version uses?

Yes, the last syncing to VSCode of the current latest release version of vtsls is at #108, which is before the fix landed on the upstream: microsoft/vscode@60182c7. The next release should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants