emacs-lsp / lsp-dart

lsp-mode :heart: dart
https://emacs-lsp.github.io/lsp-dart
GNU General Public License v3.0
202 stars 24 forks source link

Can't run lsp-dart in a dart file #195

Open softode-code opened 1 year ago

softode-code commented 1 year ago

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

ericdallo commented 1 year ago

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

softode-code commented 1 year ago

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

ericdallo commented 1 year ago

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

softode-code commented 1 year ago

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]  ▄  ▄▄  ▄▄  ▄▄  ▄▄  ▄▄
 ███▄▄  ██▬██▬██  ██▬██▬██  ██▬██▬██  ██▬██▬██  ██▬██▬██
 █████▀▀ ████  ████  ████  ████  ████
 █▀▀  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄
 █  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄ ▄█▄  ███▀████▀███  ███▀████▀███  ███▀████▀███  ███▀████▀███  ███▀████▀███  ▀ ▀  ▀ ▀  ▀ ▀  ▀ ▀  ▀ ▀
  ▄  ▄▄  ▄▄  ▄▄  ▄▄  ▄▄
 ███▄▄  ██▬██▬██  ██▬██▬██  ██▬██▬██  ██▬██▬██  ██▬██▬██
 █████▀▀ ████  ████  ████  ████  ████
 █▀▀  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄  ▄██ ██▄
 █  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄  ▄▄▄▀█ █▀▄▄▄ ▄█▄  ███▀████▀███  ███▀████▀███  ███▀████▀███  ███▀████▀███  ███▀████▀███  ▀ ▀  ▀ ▀  ▀ ▀  ▀ ▀  ▀ ▀

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

softode-code commented 1 year ago

@ericdallo please support on this.

ericdallo commented 1 year ago

@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?

softode-code commented 1 year ago

Still the same result.

ericdallo commented 1 year ago

Could you try lsp-start-pain.el ?

softode-code commented 1 year ago

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

image

softode-code commented 1 year ago

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.

ericdallo commented 1 year ago

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

softode-code commented 1 year ago

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

image