Closed real-or-random closed 1 year ago
I have the same thing happening while using company-box while editing typescript files.
The issue can be replicated. Say that I have a class attribute called "pinnedUsers", so if I type this.pin
in some method and stop there, C-g the company pop-up, and manually invoke company-complete-common
(or move away the point and return it to just after this.pin
and try start typing again).
The error I get is: Company: frontend company-box-frontend error "Company: backend company-capf error "Wrong type argument: integer-or-marker-p, nil" with args (match pinnedUsers)" on command show
.
Try disabling company-box-mode
and using the built-in popup front-end. Is the problem the same then?
Sounds like it's an lsp-mode issue.
Try disabling
company-box-mode
and using the built-in popup front-end. Is the problem the same then?
The problem disappears when I do this, so I think this is really related to company-box
.
Same for me, disabling company-box-mode
gets rid of the problem. The error states that it is the company-box-frontend
that is throwing an error. It is entirely possible that a recent update to the LSP package has caused this and company-box
just needs to adapt to the change.
Frontends are allowed to call into backends, and lsp-completion--company-match
is at the end of the backtrace.
But if you only see the error with company-box
, it could be doing something wrong indeed.
@real-or-random @dchrzanowski I am not able to reproduce the issue.
I agree with @dgutov, this seems like a lsp-mode
issue to me. It's weird that it occurs only when company-box
is enabled.
In the stacktrace I see lsp-completion-start-point nil
, it shouldn't be a nil
, and company-box
does not modify that variable.
Could you please try to revert https://github.com/emacs-lsp/lsp-mode/commit/03e1818acae6de9a6ed89c54573f8050e4d4e463, see if it makes any difference ?
Alternatively, can you try to disable the doc with (setq company-box-doc-enable nil)
.
My guess is that the value of lsp-completion-start-point
might get lost when company-box
pops new buffer/frames.
Perhaps if lsp-completion-start-point
's value is buffer-local, you might be querying it in a different buffer, thus getting an error?
(with-current-buffer ...)
around the company-fill-propertize
call could help. If that is indeed the problem.
lsp-completion-start-point
is a property on the candidate.
In the stacktrace we can see that it's already nil
before the call to company-fill-propertize
: from the line company-box--display
.
So I don't think it's related to company-fill-buffer
call.
I just checked further @real-or-random's stacktrace, on the line/call of company-box--display
:
We can see that only the 1st candidate does have a lsp-completion-start-point nil
.
The 2nd and 3rd candidates have a correct value lsp-completion-start-point 8012
, they also have the property :_emacsStartPoint 8012
, while the 1st candidate is missing it.
The commit https://github.com/emacs-lsp/lsp-mode/commit/03e1818acae6de9a6ed89c54573f8050e4d4e463 looks suspicious to me. If someone could try to revert it locally.
That's probably an issue to open in the lsp-mode repository, or maybe @yyoncho can help here ?
Hi. I also encountered this problem, and tried reverting emacs-lsp/lsp-mode@03e1818 locally as suggested. The problem went away after that. Everything works fine now. Hope this helps.
@sebastiencs Would you be willing to file a lsp-mode
issue then? I think you're the one who can describe the problem best.
@sebastiencs Would you be willing to file a
lsp-mode
issue then? I think you're the one who can describe the problem best.
I will do a fix later today
@real-or-random just pushed a fix, you can test it out.
Awesome! I'm traveling, so I don't have the time to test it right now. But maybe @vekatze or @dchrzanowski are willing to test.
I've upgraded lsp-mode and been trying it. Things are running great without any errors, at least on my environment. My Emacs world is peaceful again. Thank you for your fix, @yyoncho.
Great. Thanks everyone
emacs 29.0
Package versions:
Backtrace: