Tide stopped working with deno?
finalclass opened this issue · comments
When submitting issues to this project, please include the following information.
Checklist
- I have searched both open and closed issues and cannot find a duplicate.
- I can reproduce the problem with the latest version of the relevant packages.
- The problem still occurs after I issued
M-x tide-restart-server
in the buffer where I had the problem. - I verified that the version and the configuration file path reported by
M-x tide-verify-setup
are correct. - If tide is reporting an error or warning I think should not be reported, I can run
tsc
(andtslint
, if applicable) without the error or warning I'm seeing in tide. - If tide is not reporting an error or warning I think should be reported,
tsc
(ortslint
, if applicable) reports the error or warning I was expecting to see. - I am positive the problem does not belong to
typescript-mode
ortsserver
.
Relevant Version Numbers
- Tide: 5.1.3
- TypeScript: 4.9.4
- Emacs: 28.2
- Deno: 1.35.0
Steps to Reproduce the Bug
Remove all emacs configuration and use this .emacs.d/init.el file instead:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(use-package typescript-mode
:ensure t)
(use-package tide
:ensure t)
(use-package company
:ensure t)
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
(company-mode +1))
(setq company-tooltip-align-annotations t)
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
(add-hook 'typescript-ts-mode-hook #'setup-tide-mode)
(eval-when-compile
(add-to-list 'load-path "<path where use-package is installed>")
(require 'use-package))
Create a new project:
mkdir example
cd example
npm init -y
npm install --save-dev typescript-deno-plugin typescript
echo "{}" > deno.json
use this tsconfig.json (all standard and official settings for deno):
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"isolatedModules": true,
"jsx": "react",
"lib": [
"deno.window"
],
"module": "esnext",
"moduleDetection": "force",
"strict": true,
"target": "esnext",
"useDefineForClassFields": true,
"plugins": [
{
"name": "typescript-deno-plugin",
"enable": true,
"importmap": "import_map.json"
}
]
}
}
Create test.ts file
export function test() {
console.log("test");
}
Create main.ts file
import { test } from "./test.ts";
test();
Expected Behavior
Deno style imports work fine
Actual Behavior
Can you explain what is the issue here? As for as I can see, you get a error from tide and you need to figure out which config to set, to disable that (at tsconfig.json/deno level). Tide is just showing what tsserver is reporting as error.
Btw, looking at the deno docs, they don't mention tide anymore. Since I don't use deno, I don't have much context about how the tooling works. Whether they still use tsserver or they switched over to lsp. If it's the second case, you might have to move to lsp-mode/eglot.
Right, I must have looked into an old version of deno instructions. Thanks for clarifying - they apparently dropped support for tide.
I will need to figure out a way of running lsp for deno and tide for the rest of typescript projects. Ehhhh, it used to be working so nice before.