fannheyward / coc-deno

Deno extension for coc.nvim
MIT License
151 stars 9 forks source link

[tsserver 2304] [E] Cannot find name 'Deno'. #76

Closed Smithx10 closed 3 years ago

Smithx10 commented 3 years ago

After installing Deno and configuring CoC neovim is showing errors that "[tsserver 2304] [E] Cannot find name 'Deno'."

Although completions are working.

Deno tsserver

arch@9d46dd2d-1178-ce83-cbc4-d396e4a24060 ~/g/denolearning Γ¥»Γ¥»Γ¥» deno --version
deno 1.7.5 (release, x86_64-unknown-linux-gnu)
v8 9.0.123
typescript 4.1.4

arch@9d46dd2d-1178-ce83-cbc4-d396e4a24060 ~/g/denolearning Γ¥»Γ¥»Γ¥» cat ~/.config/nvim/coc-settings.json                                                                                                                                                                              Γ£ÿ 130
{
  "deno.enable": true,
  "deno.lint": true,
  "deno.unstable": true,
  "deno.config": "/home/arch/.tsconfig.json"
}
fannheyward commented 3 years ago

Tested with same version of deno as you, can't reproduce.

yaegassy commented 3 years ago

@Smithx10 Do you have coc-deno installed? Or is it coc-denoland? In the case of coc-denoland, please report it to the coc-denoland issue.


As an additional note, for coc-denoland, you also need to set "tsserver.enable": false.

Smithx10 commented 3 years ago

Any Ideas ?

arch@9d46dd2d-1178-ce83-cbc4-d396e4a24060 ~/g/denolearning ❯❯❯ ls -1 ~/.config/coc/extensions/node_modules | sort
coc-actions
coc-cmake
coc-css
coc-cssmodules
coc-deno
coc-git
coc-go
coc-html
coc-java
coc-json
coc-marketplace
coc-metals
coc-powershell
coc-python
coc-rls
coc-rust-analyzer
coc-snippets
coc-solargraph
coc-svg
coc-tsserver
coc-ultisnips
coc-xml
coc-yaml
JavaScriptSnippets
Classy-Bear commented 3 years ago

I found this problem too, I fixed disabling of coc-tserver in current workspace because it was making conflict with it.

coc-tserver enabled and coc-deno enabled.

Screen Shot 2021-03-26 at 11 07 59 AM

Doesn't find Deno Doesn't find top level await

coc-tserver not enabled and coc-deno enabled.

Screen Shot 2021-03-26 at 11 07 25 AM

Finds Deno and suggest change "Denos" for "Deno" Finds top level await

fannheyward commented 3 years ago

I'm using coc-tsserver 1.6.8 and coc-deno 3.2.0, can't reproduce this issue, don't need to disable coc-tsserver.

Classy-Bear commented 3 years ago

I'm using coc-tsserver 1.6.8 and coc-deno 3.2.0, can't reproduce this issue, don't need to disable coc-tsserver.

Could you show your javascript configuration? I'm guessing that deno-ts is overriding tsserver in your environment or my configuration is prioritizing tsserver over deno-ts because when I disabled tsserver, deno-ts runs fine as you just show here.

maheshsundaram commented 3 years ago

@Classy-Bear I am having the same problem - did you find a resolution?

Classy-Bear commented 3 years ago

@Classy-Bear I am having the same problem - did you find a resolution?

Not yet, meanwhile I have coc-tserver disabled because I don't use it anymore. I will investigate why this happens and let you know if I find something useful.

maheshsundaram commented 3 years ago

OK sure, thank you. I also disabled coc-tsserver as a workaround. At least it's simple to do.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday, April 14th, 2021 at 7:19 PM, David @.***> wrote:

@Classy-Bear I am having the same problem - did you find a resolution?

Not yet, meanwhile I have coc-tserver disabled because I don't use it anymore. I will investigate why this happens and let you know if I something useful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fannheyward commented 3 years ago

@maheshsundaram what's the version coc-deno you used?

maheshsundaram commented 3 years ago

Firstly, thank you for your wonderful plugin! Very helpful!

coc-deno is 3.2.0 coc-tsserver is 1.5.8 deno version 1.9.0

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday, April 14th, 2021 at 8:16 PM, Heyward Fann @.***> wrote:

@.***(https://github.com/maheshsundaram) what's the version coc-deno you used?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

fannheyward commented 3 years ago

Still can't reproduce this error.

console.log(Deno.args[0]);

.vim/coc-settings.json

{
  "deno.enable": true,
  "deno.lint": true,
  "deno.unstable": true
}

coc-deno 3.3.0 and coc-tsserver 1.7.0.

yaegassy commented 3 years ago

@Classy-Bear @maheshsundaram

Is there a minimum reproducible procedure?

This is the procedure I tried, coc-deno has no problem and is behaving correctly.


  1. Preparation
mkdir -p /tmp/deno-check
cd /tmp/deno-check
nvim check.ts

The code is this one from the official manual. https://deno.land/manual@v1.9.0/getting_started/first_steps#making-an-http-request

  1. Run:CocCommand deno.initializeWorkspace and checked and <CR>.

DEMO

coc-deno-issue-ok1

Classy-Bear commented 3 years ago

@yaegassy I reproduce your demo and I wasn't able fix the problem. Here is my version, and configurations if it helps:

Extensions
![Screen Shot 2021-04-15 at 8 55 51 PM](https://user-images.githubusercontent.com/37255403/114956609-3d0e5b00-9e2d-11eb-9483-7417bef9a66c.png)
Global configuartion
![Screen Shot 2021-04-15 at 8 56 20 PM](https://user-images.githubusercontent.com/37255403/114956667-5a432980-9e2d-11eb-9263-9a3d668f5730.png)
Local configuration
![Screen Shot 2021-04-15 at 8 56 32 PM](https://user-images.githubusercontent.com/37255403/114956726-747d0780-9e2d-11eb-9fc4-d1ac480dcefa.png)
Vim configuration
```vim call plug#begin('~/.vim/plugged') " ------------ UI ------------ " Gruvbox theme. Plug 'morhetz/gruvbox' " Dracula theme. Plug 'dracula/vim', { 'as': 'dracula' } " Ariline - bottom bar Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " NERDTree - file navigation Plug 'preservim/nerdtree' " GitGutter - Shows git diff Plug 'airblade/vim-gitgutter' " -------------------------------- " ------------ File add-ons ------------ " You should be able to see and destroy trailing whitespaces. " You can clean trailing whitespace with :FixWhitespace. Plug 'bronson/vim-trailing-whitespace' " -------------------------------- " ------------ Programming ------------ " Conquer of Completion: Smart completitions Plug 'neoclide/coc.nvim', {'branch': 'release'} " Needed for flutter commands... Plug 'dart-lang/dart-vim-plugin' Plug 'thosakwe/vim-flutter' " -------------------------------- call plug#end() " ------------ NERDTree configuration ------------ " Start NERDTree and put the cursor back in the other window. autocmd VimEnter * NERDTree | wincmd p " Exit Vim if NERDTree is the only window left. autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | \ quit | endif " -------------------------------- " ------------ Air-line configuration ------------ let g:airline_powerline_fonts = 1 let g:python3_host_prog = '/usr/local/bin/python3' if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_symbols.dirty='' function! AirlineInit() let g:airline_section_a = airline#section#create(['mode', ' ', 'branch']) let g:airline_section_b = airline#section#create(["🐻 on ", '%f']) let g:airline_section_c = airline#section#create_right(['%M']) let g:airline_section_z = airline#section#create_right(['%l:%c/%L - %p%%']) endfunction autocmd User AirlineAfterInit call AirlineInit() " -------------------------------- " Flutter configuration. -- Plug 'thosakwe/vim-flutter' nnoremap fa :FlutterRun nnoremap fq :FlutterQuit nnoremap fr :FlutterHotReload nnoremap fR :FlutterHotRestart nnoremap fD :FlutterVisualDebug " -------------------------------- "--------------Personal configuration.-------------- set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab "Set number of spaces a tab has. set number "Show current line number of the file. set t_Co=256 "It specifically refers to the number of colors the terminal supports. colorscheme gruvbox "Vim theme -> https://github.com/morhetz/gruvbox set background=dark "Setting vim theme in dark mode. set relativenumber "Setting line numbers in a relative way. set cursorline "Highlight current line. set encoding=UTF-8 set splitright set splitbelow " To see my 80th column if (exists('+colorcolumn')) set colorcolumn=80 highlight ColorColumn ctermbg=7 endif " Copy and paste :inoremap "+pa :vnoremap "+y :vnoremap "+d "--------------Personal configuration.-------------- ```
$ deno version
deno 1.9.0 (release, x86_64-apple-darwin)
v8 9.1.269.5
typescript 4.2.2
yaegassy commented 3 years ago

@Classy-Bear

If you really tried the same steps as I did (from creating the directory) and the problem persists, I don't know the cause of the problem either.

There seems to be nothing wrong with your various settings.

Try other machine environments using docker, vagrant, virtualbox, etc. and you may find the cause of your problem to be solved.

Classy-Bear commented 3 years ago

Yeah I will try that, thanks for your amazing help. Definitely is a problem with my environment, when I run :CocCommand deno.initializeWorkspace It flashes (The error goes away, it shows some warnings in the code and then the ts-server errors returns).

Lite5h4dow commented 3 years ago

Screenshot 2021-09-03 at 11 51 39

im having the same issue and my imports arent working

igorbrasileiro commented 1 year ago

Is is possible to use coc-deno with another coc extension to show twind class suggestions that depends on coc-tsserver? I'm trying to port this extension https://github.com/tw-in-js/vscode-twind-intellisense/ that would depends on coc-tsserver like this one https://github.com/fannheyward/coc-styled-components/

fannheyward commented 1 year ago

@igorbrasileiro I don't think we can use these extensions with coc-deno or Deno LSP, cause typescript-styled-plugin etc plugins can only work as TypeScript plugins with tsconfig.json.