fannheyward / coc-deno

Deno extension for coc.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Still getting linting errors when importing with `.ts` extension.

cjnucette opened this issue · comments

I'm still getting error from tsserver when importing .ts files, and top level await. Is there an option I should set or something?

Please give a test code that can reproduce this issue.

I was doing some testing with this:

import { serve } from 'https://deno.land/std/http/server.ts';
const s = serve({ port: 8000 });
console.log('http://localhost:8000/');

for await (const req of s) {
  console.log(req.url);
  req.respond({ body: `Hello World\n${req.url}` });
}

I get the following errors:
index.ts|1 col 23 error| [tsserver 2691] An import path cannot end with a '.ts' extension. Consider importing 'https://deno.land/std/http/server' instead. [E]
and
index.ts|5 col 5 error| [tsserver 1103] A 'for-await-of' statement is only allowed within an async function or async generator. [E]

Thanks.

  1. How do you install coc-deno? By :CocInstall coc-deno?
  2. Tested with your code and there is no first error. Only for-await-of error shows.
  3. Tested with VSCode+ Deno extension, also shows the second error. coc-deno uses the same typescript-deno-plugin, so it's not coc-deno error.

I am also getting errors for .ts extensions after installing this extension. Not sure if it's other configuration in coc which is causing the issue.

Ok, let me check, because vscode does the exact same thing. This is weird, but most likely something on my end. Thanks anyways.

@fannheyward Still getting all these errors

@Seanmclem I have to uninstall it, because it breaks coc-tsserve completions for me.

截屏2020-05-07 13 39 20

Fixed in v0.5.0. And add a code action to fix importing error.

commented

@fannheyward
Still getting errors after applying the coc action "Convert named imports to namespace import":

image

I can't disable the extension in non-deno typescript files so I'm getting error on regular imports like in import { something} from 'components/something';. I tried disabling deno.enable: false in CocLocalConfig with no luck (or regular CocConfig with the same result).

@cjnucette yes, there are errors on non-deno files, but it's not coc-deno's issue, but typescript-deno-plugin, vscode-deno also has this error: https://github.com/justjavac/vscode-deno/issues/70

:CocList extensions to list all extensions you have installed, filter coc-deno, tab to select disable action.

commented

@fannheyward any suggestions for my previous comment? I'm still getting errors.

2020-05-12 18 39 22

@foisonocean Same error on VSCode + vscode-deno.

commented

Got it. I suggest keep this issue open until upstream fixed.

I had to create a .vscode folder with a settings json in it and enable deno there. is that in the readme?

Hey, I'm getting this error even after disabling the coc-deno extension from the extensions list
2020-05-28_16-14
. I'm not sure if this is for the same reason as everyone else, but I think it correlates with this?

@fannheyward can you clarify what you meant by "disable the extension" in #25 . Now that I actually tried your suggestion I don't think it works (although uninstalling does). I tried disabling the extension from the coc extensions list but that did nothing. Even after reloading tsserver and the buffer.

@alextes yes, disable doesn't work. I'll look into this.

I'm guessing this boils down to coc-deno manipulating a tsserver config that is global somehow, and leaks to other running neovim instances that are also using tsserver. Perhaps coc is even designed to be using one language server per language which would be problematic here.

@fannheyward any idea where I could start looking to fix this?

For those who get a linting error after enabling coc-deno probably you have another linter that creates that errors It was ALE plugin in my case. Hope this helps.

Is this extension still based on https://github.com/justjavac/vscode-deno ? Because there is an official one out there https://github.com/denoland/vscode_deno, which seems to integrate previous extensions.

try v3.0.0, use deno lsp.

the error still accurate.

look at version 3.0.1 on VSCode_deno

@hemedani You need to either deno.initializeWorkspace (which I'm not able to find in my case) or you can create a local .vim/coc-settings.json in which you need to enable deno.

@cjnucette deno.initializeWorkspace works with :CocCommand deno.initializeWorkspacebut how can i disabledeno.initializeWorkspace` ?

I'm on the monorepo with react and other typescript code so I want's to enable and disable Deno lsp on some files

it's create .vim/coc-settings.json file on the root directory so I should be delete this or move file to Deno project directory !
tanx

I don't think you can enable/disable deno by file, but by directory. So you should create this file in the directory where your deno project is located.

I have the same problem, but it will not happen in VS Code.

@mrxiaozhuox what's your coc-deno version?

@fannheyward The latest version.

@fannheyward coc-deno: 3.4.0 coc-tsserver: 1.7.0 deno: 1.10.1

@mrxiaozhuox can't reproduce. What's the content of .vim/coc-settings.json in your project?