Open gatoasmatico opened 1 month ago
Try import http from 'node:http'
, looks like something wrong in your tsconfig.json?
I replaced const http = require("node:http")
with import http from 'node:http'
and it still doesn't recognize it. I don't have a tsconfig.json file because I'm not using TypeScript, I'm using JavaScript.
Check the QA in README https://github.com/neoclide/coc-tsserver?tab=readme-ov-file#q--a
You need to setup jsconfig.json to make tsserver understand your code.
I created a jsconfig.json on my project root with { "include": ["./main.js"], "module": "ES6", "checkJs": true }
, i added npm global path and the coc-status line, which only shows "Initializing tsserver" and "TSC 5.6.2". Nothing has changed, still not recognizing.
I ran npm --global install typescript@5.5
and configured tsserver.tsdk to use it and now it works!
When I was trying to figure out why it was working in termux but not in MSYS, I noticed that the TSC version in my termux was 5.5.4.
I'm on windows, using vim through MSYS2, and i'm trying to use coc-tsserver to work on a Nodejs project, but the extension isn't recognizing node built-in modules, not even the global variables like Buffer. Is this a problem from MSYS or the extension?
I also noticed that
:CocConfig
is not auto-completing some tsserver configuration options like "tsserver.log"I also use this extension on my Android through termux and it works perfectly. Node and NPM have been installed from nodejs.org and can be accessed by MSYS via "MSYS2_PATH_TYPE=inherit" in msys2.ini. I've already run both
npm install typescript @types/node
andnpm install --global typescript @types/node
. I can provide tsserver.log, but I don't think I should just paste the text here because it has many lines, so if anyone wants me to send the tsserver.log, please tell me the best way.