emacs-lsp/lsp-dart

company with lsp-dart does not completion after "." has been typed.

chap9 opened this issue · 0 comments

chap9 commented

Describe the bug
lsp-dart is installed, but when "obj." is typed, completion is not triggered as expected. Execute company-capf manually will show the completion.

To Reproduce

This is the minimal config that can reproduce the problem. Will use straight and use-package, but they probably irrelevant with this issue. The cc-mode used here is trying to show that completion works fine with c++.

(if (eq system-type 'darwin)
  (setq
    mac-command-modifier 'control
    mac-option-modifier 'meta))

(defvar bootstrap-version)
(let
  (
    (bootstrap-file
      (expand-file-name "straight/repos/straight.el/bootstrap.el"
        user-emacs-directory))
    (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
      (url-retrieve-synchronously
        "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
        'silent
        'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(use-package
  lsp-mode
  :ensure t
  :defer t
  :straight t
  :config
  (setq lsp-signature-function 'lsp-signature-posframe)
  (setq lsp-modeline-diagnostics-scope :file)
  (setq lsp-lens-enable t)
  :ensure t)


(use-package
  lsp-ui
  :ensure t
  :defer t
  :straight t
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (setq lsp-ui-doc-use-webkit t)
  (setq lsp-ui-doc-max-width 60)
  (setq lsp-ui-doc-show-with-mouse nil)
  (setq lsp-ui-doc-show-with-cursor t)
  (setq lsp-ui-doc-position 'at-point)
  (setq lsp-ui-doc-delay 1.5))

(use-package
  lsp-dart
  :ensure t
  :straight t
  :hook
  (dart-mode . lsp-deferred))


(use-package
  company-posframe
  :requires posframe
  :ensure t
  :straight t
  :diminish company-posframe-mode)


(use-package
  company
  :straight t
  :ensure t
  :defer t
  :config
  (company-posframe-mode 1)
  (setq company-idle-delay 0)
  (setq company-show-quick-access t)
  (setq company-selection-wrap-around t))


(use-package
  cc-mode
  :ensure t
  :defer t
  :straight t
  :hook
  (c++-mode . lsp-deferred))

Expected behavior
Completion shows after typed ".".

Screenshots

class SomeType {
  SomeType();

  void func1() {
    print("Hello world");
  }
}

void main() {
  var x = SomeType();
  x. // --> SHOW THE candidates, like func1, hashCode etc.
}

Version
[LSP Dart] 1.24.2 at 2023.10.25 @ Emacs 28.2
[Dart SDK] Dart SDK version: 3.1.4 (stable) (Tue Oct 17 14:55:53 2023 +0000) on "macos_arm64"

[Flutter SDK] /opt/homebrew/Caskroom/flutter/3.13.8/flutter/
[Flutter project] false
[Project entrypoint] Not found