-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Describe the bug
When starting lsp mode for a scala file I get the message 'Unable to find installed server supporting this file. The following servers could be installed automatically: ' with no options for the server shown. Manually evaling 'lsp-install-server metals' results in the message that the server is being installed and a message in the Messages buffer:
LSP :: Download metals started. LSP :: Starting to download https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz to /Users/chrishowe-jones/.emacs.d/.cache/lsp/metals/coursier.gz... Contacting host: github.com:443
Nothing ever completes and there is nothing in the .cache/lsp/metals directory.
To Reproduce
MacOS: Soonma 14.5
Emacs-plus version: GNU Emacs 29.3 (build 1, aarch64-apple-darwin23.4.0, NS appkit-2487.50 Version 14.4.1 (Build 23E224)) of 2024-04-06
sbt version: 1.10.0
Scala version: 3.4.2
Created a new init.el with the recommended snippet from this repo:
`
(require 'package)
;; Add melpa to your packages repositories
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; Install use-package if not already installed
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
;; Enable defer and ensure by default for use-package
;; Keep auto-save/backup files separate from source code: scalameta/metals#1027
(setq use-package-always-defer t
use-package-always-ensure t
backup-directory-alist ((".*" . ,temporary-file-directory)) auto-save-file-name-transforms
((".*" ,temporary-file-directory t)))
;; Enable scala-mode for highlighting, indentation and motion commands
(use-package scala-mode
:interpreter ("scala" . scala-mode))
;; Enable sbt mode for executing sbt commands
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: hvesalai/emacs-sbt-mode#31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)
;; sbt-supershell kills sbt-mode: hvesalai/emacs-sbt-mode#152
(setq sbt:program-options '("-Dsbt.supershell=false")))
;; Enable nice rendering of diagnostics like compile errors.
(use-package flycheck
:init (global-flycheck-mode))
(use-package lsp-mode
;; Optional - enable lsp-mode automatically in scala files
;; You could also swap out lsp for lsp-deffered in order to defer loading
:hook (scala-mode . lsp)
(lsp-mode . lsp-lens-mode)
:config
;; Uncomment following section if you would like to tune lsp-mode performance according to
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
;; (setq gc-cons-threshold 100000000) ;; 100mb
;; (setq read-process-output-max (* 1024 1024)) ;; 1mb
;; (setq lsp-idle-delay 0.500)
;; (setq lsp-log-io nil)
;; (setq lsp-completion-provider :capf)
(setq lsp-prefer-flymake nil)
;; Makes LSP shutdown the metals server when all buffers in the project are closed.
;; https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-keep-workspace-alive
(setq lsp-keep-workspace-alive nil))
;; Add metals backend for lsp-mode
(use-package lsp-metals)
;; Enable nice rendering of documentation on hover
;; Warning: on some systems this package can reduce your emacs responsiveness significally.
;; (See: https://emacs-lsp.github.io/lsp-mode/page/performance/)
;; In that case you have to not only disable this but also remove from the packages since
;; lsp-mode can activate it automatically.
(use-package lsp-ui)
;; lsp-mode supports snippets, but in order for them to work you need to use yasnippet
;; If you don't want to use snippets set lsp-enable-snippet to nil in your lsp-mode settings
;; to avoid odd behavior with snippets and indentation
(use-package yasnippet)
;; Use company-capf as a completion provider.
;;
;; To Company-lsp users:
;; Company-lsp is no longer maintained and has been removed from MELPA.
;; Please migrate to company-capf.
(use-package company
:hook (scala-mode . company-mode)
:config
(setq lsp-completion-provider :capf))
;; Posframe is a pop-up tool that must be manually installed for dap-mode
(use-package posframe)
;; Use the Debug Adapter Protocol for running tests and debugging
(use-package dap-mode
:hook
(lsp-mode . dap-mode)
(lsp-mode . dap-ui-mode))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(company yasnippet lsp-ui lsp-metals lsp-mode flycheck sbt-mode scala-mode)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
`
I am not behind a proxy.
Expected behavior
Metals installs and running lsp mode in a Scala mode buffer results in the server starting and connecting correctly.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
Messages in Messages buffer:
LSP :: Download metals started. LSP :: Starting to download https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz to /Users/chrishowe-jones/.emacs.d/.cache/lsp/metals/coursier.gz... Contacting host: github.com:443 ... LSP :: There are language server((metals)) installation in progress. The server(s) will be started in the buffer when it has finished.