Hi everyone,
I've set up `lsp-mode`, `lsp-ui`, `lsp-ivy` and `company` to work on my javascript files. As LS I am using the theia-ide recommended one.
In my working enviroment I use Mozilla Rhino as the js engine so the syntax may be sometimes different to the standard javascript. Unfortunatly there isn't a LS specifically designed for Rhino.
Everything seems to work fine except for the completion of imported files. In Rhino the import statement for loading another js file is `load('/path/to/js/file')` and what I am missing in my workspace is completions and suggestions for variables, functions and other stuff defined other files different from the one I'm working on.
(use-package lsp-mode
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l"
lsp-auto-guess-root t
lsp-clients-typescript-npm-location "/usr/local/bin/npm")
;; tuning
(setq gc-cons-threshold 100000000
read-process-output-max (* 1024 1024)
lsp-idle-delay 0.5)
:config
(lsp-enable-which-key-integration t))
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
:custom
(lsp-ui-doc-position 'bottom))
(use-package lsp-ivy
:hook (lsp-mode . lsp-ivy-mode))
(use-package company
:after lsp-mode
:hook (lsp-mode . company-mode)
:bind (:map company-active-map
("<tab>" . company-complete-selection))
(:map lsp-mode-map
("<tab>" . company-indent-or-complete-common))
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0))
In addition I have also a minimal configuration for `js2-mode` that I'm leaving here.
(use-package js2-mode
:mode "\\.js\\'"
:hook (js2-mode . lsp-deferred)
:config
(setq js2-basic-offset 2))
(use-package js2-refactor)
(use-package xref-js2)
If anything is unclear or needs more specification just tell me.
Thank you in advance.