emacs-lsp/lsp-dart

Can't run lsp-dart in a dart file

softode-code opened this issue · 12 comments

I can not run dart-mode in doom-emacs. I have defined it in lang: as

(dart +flutter +lsp)

I have copied the config from https://emacs-lsp.github.io/lsp-dart/ exmaple:

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize)

(setq package-selected-packages
  '(dart-mode lsp-mode lsp-dart lsp-treemacs flycheck company
    ;; Optional packages
    lsp-ui company hover))

(when (cl-find-if-not #'package-installed-p package-selected-packages)
  (package-refresh-contents)
  (mapc #'package-install package-selected-packages))

(add-hook 'dart-mode-hook 'lsp)

(setq gc-cons-threshold (* 100 1024 1024)
      read-process-output-max (* 1024 1024))

Screenshots
image

Do you have flutter / dart available in your $PATH? if so, try starting emacs from terminal which has that available

Yes, I have flutter in my PATH and I started emacs from that terminal. Still the same result.

Alright, could you follow the issue template and include here the result of: M-x lsp-dart-version?

I get the following result when I run lsp-dart-version:

[LSP Dart] 1.24.1 at 2023.04.26 @ Emacs 28.2
[Dart SDK]
�[33m ▄ �[31m ▄▄ �[32m ▄▄ �[34m ▄▄ �[35m ▄▄ �[36m ▄▄
�[33m ███▄▄ �[31m ██▬██▬██ �[32m ██▬██▬██ �[34m ██▬██▬██ �[35m ██▬██▬██ �[36m ██▬██▬██
�[33m █████▀▀�[31m ████ �[32m ████ �[34m ████ �[35m ████ �[36m ████
�[33m █▀▀ �[31m ▄██ ██▄ �[32m ▄██ ██▄ �[34m ▄██ ██▄ �[35m ▄██ ██▄ �[36m ▄██ ██▄
�[33m █ �[31m ▄▄▄▀█ █▀▄▄▄ �[32m ▄▄▄▀█ █▀▄▄▄ �[34m ▄▄▄▀█ █▀▄▄▄ �[35m ▄▄▄▀█ █▀▄▄▄ �[36m ▄▄▄▀█ █▀▄▄▄
�[33m▄█▄ �[31m ███▀████▀███ �[32m ███▀████▀███ �[34m ███▀████▀███ �[35m ███▀████▀███ �[36m ███▀████▀███
�[31m ▀ ▀ �[32m ▀ ▀ �[34m ▀ ▀ �[35m ▀ ▀ �[36m ▀ ▀
�[1m
�[93m ▄ �[91m ▄▄ �[92m ▄▄ �[94m ▄▄ �[95m ▄▄ �[96m ▄▄
�[93m ███▄▄ �[91m ██▬██▬██ �[92m ██▬██▬██ �[94m ██▬██▬██ �[95m ██▬██▬██ �[96m ██▬██▬██
�[93m █████▀▀�[91m ████ �[92m ████ �[94m ████ �[95m ████ �[96m ████
�[93m █▀▀ �[91m ▄██ ██▄ �[92m ▄██ ██▄ �[94m ▄██ ██▄ �[95m ▄██ ██▄ �[96m ▄██ ██▄
�[93m █ �[91m ▄▄▄▀█ █▀▄▄▄ �[92m ▄▄▄▀█ █▀▄▄▄ �[94m ▄▄▄▀█ █▀▄▄▄ �[95m ▄▄▄▀█ █▀▄▄▄ �[96m ▄▄▄▀█ █▀▄▄▄
�[93m▄█▄ �[91m ███▀████▀███ �[92m ███▀████▀███ �[94m ███▀████▀███ �[95m ███▀████▀███ �[96m ███▀████▀███
�[91m ▀ ▀ �[92m ▀ ▀ �[94m ▀ ▀ �[95m ▀ ▀ �[96m ▀ ▀
�[0m
Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "linux_x64"

[Flutter SDK] /home/umer/Development/flutter/
[Flutter project] true
[Project entrypoint] /home/umer/Development/quizapp/lib/main.dart

@ericdallo please support on this.

@softode-code sorry for the delay.

The output looks correct (besides the weird dart sdk chars), and I noticed you are using doom-emacs, so no extra config from https://emacs-lsp.github.io/lsp-dart/ is necessary, you can check my dotfiles for my doom-emacs as example. Make sure you run doom sync after each init.el change

could you try on this sample project?

Still the same result.

Could you try lsp-start-pain.el ?

I ran "lsp-start-plain", a new emacs window opened with the below messages:

image

Here is the logs from "lsp-log":

Command "/home/umer/Development/flutter/bin/cache/dart-sdk/bin/dart language-server --client-id emacs.lsp-dart --client-version 1.24.1" is present on the path.

That was probably an instability in melpa for downloading packages, trying again should work

I again ran "lsp-start-plain", a new emacs window opened. I opened a dart file in it but same results:

image