tide
tide copied to clipboard
Only work for the first javascript buffer.
The first js file work well,but if I kill the buffer or open other js files,it doesn't work.
I use spacemacs, so I add the configuration(from readme) on dotspacemacs/user-config.
;;tide
;;use package
(use-package tide
:ensure t
:after (typescript-mode company flycheck)
;;:hook ((typescript-mode . tide-setup)
;; (typescript-mode . tide-hl-identifier-mode)
;; (before-save . tide-format-before-save))
)
;;typescript
(require 'flycheck)
(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 is an optional dependency. You have to
;; install it separately via package-install
;; `M-x package-install [ret] company`
(company-mode +1))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
(add-hook 'js2-mode-hook #'setup-tide-mode)
;;tsx
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(setup-tide-mode))))
;; enable typescript-tslint checker
(flycheck-add-mode 'typescript-tslint 'web-mode)
;;javascript
(setq tide-format-options '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil))
;; configure javascript-tide checker to run after your default javascript checker
;;(flycheck-add-next-checker 'javascript-eslint 'javascript-tide 'append)
;;jsx
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "jsx" (file-name-extension buffer-file-name))
(setup-tide-mode))))
;; configure jsx-tide checker to run after your default jsx checker
(flycheck-add-mode 'javascript-eslint 'web-mode)
;;(flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
;;tide
tide-mode is enabled,and tsserver looks well,I don't know how to fix this problem.
Think I am experiencing the same thing. Haven't looked too deeply into it but in the logs I see an error saying TS can't find the file:
"seq": 0,
"type": "response",
"command": "documentHighlights",
"request_seq": "101",
"success": false,
"message": "Error processing request.
Could not find sourceFile: '/home/milo/scite/client/pages/HomeApp.js' in [\"/home/milo/.emacs.d/elpa/tide-20190321.1611/tsserver/lib.es6.d.ts\",
\"/home/milo/.emacs.d/elpa/tide-20190321.1611/tsserver/lib.es5.d.ts\"
...truncated
}
```
A minimal project which reproduces this issue would help us with identifying the problem. With the current description, there aren't any clues as to where the issue might be.
Is this the same issue as #211?