Recently having trouble with import paths being automatically updated in lsp-typescript. I am using version 9.0.0 (20240422.334). I intend to import files in the current directory using relative paths (e.g. ./metric), but I suspect that LSP is automatically updating them to paths of the form ../../../projects/some/other/path whenever I save. It is also common for the paths to be automatically updated such that they point to an emacs autosave/backup file.

Here is what I’ve tried so far:

 (setq lsp-javascript-preferences-import-module-specifier "relative")
  (setq lsp-javascript-suggest-auto-imports nil)
  (setq lsp-javascript-suggest-paths nil)
  (setq lsp-javascript-update-imports-on-file-move-enabled "never")

  (setq lsp-typescript-preferences-import-module-specifier "relative")
  (setq lsp-typescript-suggest-auto-imports nil)
  (setq lsp-typescript-suggest-paths nil)
  (setq lsp-typescript-update-imports-on-file-move-enabled "never")
  (setq lsp-typescript-surveys-enabled nil)

This seems to fix the usage of backup files:

  (setq backup-by-copying t)

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee