Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have to restart the server when open new files #414

Open
ChoppinBlockParty opened this issue Feb 11, 2021 · 2 comments
Open

Have to restart the server when open new files #414

ChoppinBlockParty opened this issue Feb 11, 2021 · 2 comments

Comments

@ChoppinBlockParty
Copy link

ChoppinBlockParty commented Feb 11, 2021

It is not an issue more a call for help, so please, do not close it immediately because it is not fully complying with your checklist that I tried my best to fill them up but cannot, on some smaller project it works fine, but on bigger (not that big actually more like 10 file projects, but a lot of node modules).

I have been using tide for quite a while for my web javascript, node javascript projects. Almost every second file I open in emacs I get the error below - I have to tide-restart-server.

Error processing request. Could not find source file: '/home/yuki/prj/projectb/src/connection.js'.
Error: Could not find source file: '/home/yuki/prj/projectb/src/connection.js'.
    at getValidSourceFile (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:143295:29)
    at Object.getQuickInfoAtPosition (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:143543:30)
    at IOSession.Session.getQuickInfoWorker (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:154264:62)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:153206:61)
    at /home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:155001:88
    at IOSession.Session.executeWithRequestId (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:154992:28)
    at IOSession.Session.executeCommand (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:155001:33)
    at IOSession.Session.onMessage (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:155025:35)
    at Interface.<anonymous> (/home/yuki/.emacs.d/elpa/tide-20210105.812/tsserver/tsserver.js:157241:27)
    at Interface.emit (events.js:315:20)
    at Interface._onLine (readline.js:337:10)
    at Interface._normalWrite (readline.js:482:12)
    at Socket.ondata (readline.js:194:10)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
  • Tide: 4.0.5
  • Emacs: 26.3
  • Node: 14.15

Example of node project jsconfig.json:

{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "noEmit": true,
    "checkJs": true,
  }
  "include": [
    "src/**/*",
    "node_modules/**/*"
  ]
}

If relevant, a piece of my init.el config for tide.

(use-package web-mode
  :config
  (modify-syntax-entry ?_ "w" web-mode-syntax-table)
  ;;; auto-enable for .js/.jsx files
  (add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode))
  (setq
    ;;; Enable JSX syntax highlighting in .js/.jsx files
    web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))
    web-mode-enable-auto-quoting nil
   )

  (use-package prettier-js)

  (use-package add-node-modules-path)
  (add-hook 'flycheck-mode-hook 'add-node-modules-path)

  ;;; Enable eslint checker for web-mode
  (flycheck-add-mode 'javascript-eslint 'web-mode)

  (defun web-mode-init-hook ()
    "Hooks for Web mode.  Adjust indent."
    (setq web-mode-markup-indent-offset 2
          web-mode-markup-indent-offset 2
          web-mode-css-indent-offset 2
          web-mode-code-indent-offset 2
          web-mode-script-padding 2
          web-mode-attr-indent-offset 2
          web-mode-enable-css-colorization t)
    (add-node-modules-path)
    (prettier-js-mode)
    )

  (add-hook 'web-mode-hook 'web-mode-init-hook)

  (use-package tide
    :config
    (defun setup-tide-mode()
      ;; (interactive)
      (tide-setup)
      (setq flycheck-check-syntax-automatically '(save mode-enabled))
      (tide-hl-identifier-mode 1)
      )

    ;; aligns annotation to the right hand side
    (setq company-tooltip-align-annotations t)

    (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)

    (add-hook 'typescript-mode-hook #'setup-tide-mode)
    (add-hook 'web-mode-hook #'setup-tide-mode)
    )
  )

Any guesses? Anyone had anything familiar?

@ananthakumaran
Copy link
Owner

Could you enable debug logs and check if anything shows up there.

"include": [
    "src/**/*",
    "node_modules/**/*"
  ]

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#tsconfig-bases it's typically recommended to exclude node modules folder, not include it.

@ananthakumaran
Copy link
Owner

browsing through the typescript repo, I could see a lot of similar issues, which you seem to be aware of as well. if you are hitting one of those, debugging from tide side might not help much. microsoft/TypeScript#30180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants