company-lsp
company-lsp copied to clipboard
„Args out of range“ error
Hi there,
I get the following error in one of my projects:
Company: frontend company-preview-frontend error "Args out of range: #("$for" 0 4 (lsp-completion-item #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "$for" "kind" 3 "sortText" "0" "commitCharacters" ["." "," "("] "data" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("file" "/Users/ckruse/dev/termitel/termitool/frontend/src/actions/calendar/event_feedback_actions.js" "line" 24 "offset" 65 "entryNames" ["$for"])) "insertTextFormat" 2)) lsp-completion-prefix #("addSuccessFlash" 0 15 (fontified t font-lock-face js2-function-call help-echo "Undeclared variable or function 'addSuccessFlash'" cursor-sensor-functions (js2-echo-error))) face (company-preview))), 15, nil" on command post-command
When enabling debug-on-error
I get this stacktrace:
Debugger entered--Lisp error: (args-out-of-range #("$for" 0 4 (lsp-completion-item #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "$for" "kind" 3 "sortText" "0" "commitCharacters" ["." "," "("] "data" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("file" "/Users/ckruse/dev/termitel/termitool/frontend/src/actions/calendar/event_feedback_actions.js" "line" 24 "offset" 64 "entryNames" ["$for"] ...)) "insertTextFormat" 2 ...)) lsp-completion-prefix #("addSuccessFlaa" 0 14 (fontified t font-lock-face js2-function-call help-echo "Undeclared variable or function 'addSuccessFla'" cursor-sensor-functions (js2-echo-error))) face (company-preview))) 14 nil)
company-preview-show-at-point(858 #("$for" 0 4 (lsp-completion-prefix #("addSuccessFlaa" 0 14 (fontified t font-lock-face js2-function-call help-echo "Undeclared variable or function 'addSuccessFla'" cursor-sensor-functions (js2-echo-error))) lsp-completion-item #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "$for" "kind" 3 "sortText" "0" "commitCharacters" ["." "," "("] "data" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("file" "/Users/ckruse/dev/termitel/termitool/frontend/src/actions/calendar/event_feedback_actions.js" "line" 24 "offset" 64 "entryNames" ["$for"] ...)) "insertTextFormat" 2 ...)))))
company-preview-frontend(post-command)
company-call-frontends(post-command)
company-post-command()
company-idle-begin(#<buffer event_feedback_actions.js> #<window 3 on event_feedback_actions.js> 3103 858)
apply(company-idle-begin (#<buffer event_feedback_actions.js> #<window 3 on event_feedback_actions.js> 3103 858))
timer-event-handler([t 23732 5449 304182 nil company-idle-begin (#<buffer event_feedback_actions.js> #<window 3 on event_feedback_actions.js> 3103 858) nil 0])
Am I doing something wrong or is this a bug?
Best regards, CK
I hade the same issue on Emacs 27:
Debugger entered--Lisp error: (args-out-of-range 1 1)
get-text-property(1 c-fl-syn-tab)
c-clear-string-fences()
#f(compiled-function () #<bytecode 0x1feaab1c2421>)()
c-after-change(682 731 0)
run-hook-with-args(c-after-change 682 731 0)
#f(compiled-function () #<bytecode 0x1feaaae6b3e9>)()
funcall(#f(compiled-function () #<bytecode 0x1feaaae6b3e9>))
(let nil (funcall '#f(compiled-function () #<bytecode 0x1feaaae6b3e9>)))
eval((let nil (funcall '#f(compiled-function () #<bytecode 0x1feaaae6b3e9>))))
yas--snippet-create("decode_env_path(${1:const char *}, ${2:const char ..." nil 682 682)
yas-expand-snippet("decode_env_path(${1:const char *}, ${2:const char ..." 682 746)
company-lsp--post-completion(#(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
company-lsp(post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
apply(company-lsp (post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t))))))
company-call-backend-raw(post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
apply(company-call-backend-raw (post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t))))))
company--force-sync(company-call-backend-raw (post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t))))) company-lsp)
company-call-backend(post-completion #(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
company-cancel(#(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
company-finish(#(" decode_env_path(const char *, const char *, bool)" 0 50 (company-lsp-resolved t lsp-completion-item #<hash-table equal 8/8 0x1feaab7022b9> lsp-completion-prefix #("env" 0 3 (fontified t)))))
company-complete-selection()
funcall-interactively(company-complete-selection)
call-interactively(company-complete-selection nil nil)
command-execute(company-complete-selection)
But no problem on Emacs 26, then I added an advice
to inhibit it:
(define-advice c-clear-string-fences (:around (fn) inhibit-args-out-of-range-error)
(ignore-errors
(funcall fn)))
Everything works fine.
- macOS 10.12.6
- clangd 8.0.0
- Emacs 27.0.50 (2019-07-22-6bd817ee66e7a5759ef6c5a8c12d57b5ec59043c)
- company-lsp-20190612.1553
- yasnippet-20190724.1204
I had this same error on my config, confirming the fix/workaround:
(use-package company-lsp
:after lsp company yasnippet
:init
(when (version<= "27" emacs-version)
(define-advice c-clear-string-fences
(:around (fn) inhibit-args-out-of-range-error)
(ignore-errors
(funcall fn)))))
Build info:
- Ubuntu 18.04.3 LTS x86_64
- GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
- company-lsp-20190612.1553
- yasnippet-20191222.2206