Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in condition evaluation: Symbol’s function definition is void: js2-node-type #486

Open
Daut opened this issue Jan 28, 2024 · 1 comment

Comments

@Daut
Copy link

Daut commented Jan 28, 2024

Initially reported here: joaotavora/yasnippet#1186


When working with <style> blocks of the .vue files I get the following errors when trying to expand lsp-mode suggestions.

[yas] Error in condition evaluation: Symbol’s function definition is void: js2-node-type [8 times]
[yas] Error running #[128 \302\301\303\300�""\207 [(yas-after-exit-snippet-hook) run-hooks apply append] 6 

Additionally Emacs freezes for couple of seconds before completing the selection.

I get similar errors when editing <script> tags too, but without freeze.

When I turn off yas-minor-mode Emacs stops freezing.

Below are parts of my .emacs file related to yas, lsp-mode and company-mode

(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :config
  (lsp-enable-which-key-integration t)
  (setq lsp-completion-provider :none)
  (setq lsp-headerline-breadcrumb-enable nil)
  (add-to-list 'lsp-disabled-clients '(typescript-mode . vue-semantic-server))
  (add-to-list 'lsp-disabled-clients '(js-mode . vue-semantic-server)))

(use-package company
  :hook (after-init . global-company-mode)
  :bind
  (:map company-active-map
        ("<tab>" . company-complete-selection))
  ;; (:map lsp-mode-map
  ;;       ("<tab>" . company-indent-or-complete-column))
  :config
  (setq company-minimum-prefix-length 1)
  (setq company-idle-delay 0.15)
  (setq company-dabbrev-code-ignore-case t)
  (setq company-keywords-ignore-case t)
  (setq company-dabbrev-downcase t)
  (setq completion-ignore-case t)
  (setq company-transformers '(delete-consecutive-dups
                             company-sort-by-occurrence
                             company-sort-by-backend-importance))
  :init
  (setq company-backends '((company-capf :with company-yasnippet company-dabbrev-code)
                           (company-dabbrev-code company-keywords company-files)
                           company-dabbrev)))

(use-package company-box
  :hook (company-mode . company-box-mode))

;; yasnippet
(use-package yasnippet
  :diminish yas-minor-mode
  :hook (after-init . yas-global-mode))

(use-package yasnippet-snippets
  :after yasnippet
  :config (yasnippet-snippets-initialize))
@ghosty141
Copy link

Some snippets for js-mode depend on things from js2-mode which is an external package, it should be checked if that package is installed before the functions are used.

Current offenders after a quick search:

snippets/js-mode/type-inline-comment:4:#condition: (not (= (js2-node-type (js2-node-at-point)) js2-COMMENT))
snippets/js-mode/return-comment:4:#condition: (= (js2-node-type (js2-node-at-point)) js2-COMMENT)
snippets/js-mode/type-multiline-comment:4:#condition: (= (js2-node-type (js2-node-at-point)) js2-COMMENT)
snippets/js-mode/param-comment:4:#condition: (= (js2-node-type (js2-node-at-point)) js2-COMMENT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants