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

Tide-complete yields incomplete prefix for private methods #455

Open
7 tasks done
jackschu opened this issue Oct 21, 2022 · 4 comments
Open
7 tasks done

Tide-complete yields incomplete prefix for private methods #455

jackschu opened this issue Oct 21, 2022 · 4 comments

Comments

@jackschu
Copy link

jackschu commented Oct 21, 2022

Checklist

  • I have searched both open and closed issues and cannot find a duplicate.
  • I can reproduce the problem with the latest version of the relevant packages.
    I'm on tide-/ and Company 0.9.13
  • The problem still occurs after I issued M-x tide-restart-server in the buffer where I had the problem.
  • I verified that the version and the configuration file path reported by M-x tide-verify-setup are correct.
  • If tide is reporting an error or warning I think should not be reported, I can run tsc (and tslint, if applicable) without the error or warning I'm seeing in tide.
  • If tide is not reporting an error or warning I think should be reported, tsc (or tslint, if applicable) reports the error or warning I was expecting to see.
  • I am positive the problem does not belong to typescript-mode or tsserver.

Relevant Version Numbers

  • Tide: 20220514.614
  • Company: 0.9.13
  • TypeScript:
  • tsserver version: 4.7.4
  • Emacs: 27.2 (x86_64-pc-linux-gnu)

(The list above is minimal. Make sure to include any other version numbers relevant to your report.)

Steps to Reproduce the Bug

run M-x company-diag using the company-tide backend for the string this.# inside of a class

Expected Behavior

observe "#" as the prefix
be suggested private methods from that class as completions
selecting one such method #foo results in this.#foo

Actual Behavior

observe "" as the prefix
be suggested all methods from that class as completions
selecting one such method #foo results in this.##foo

Thanks for taking a look at this and your work on this project :) I tried to dig in myself but my elisp skills lacking, looking forward to learning from how this is resolved

@ananthakumaran
Copy link
Owner

Could you share a minimal example? I am not sure I understand your issue.

#foo results in this.##foo

Are you saying if you have this.na and select a completion candidate name, you end up with this.naname? I am not able to reproduce this behavior

@jackschu
Copy link
Author

Hey thanks for the response @ananthakumaran this is specific to #-prefixed methods / private methods it seems

here's a screen grab

2022-10-22.12-18-32.mp4

@ananthakumaran
Copy link
Owner

Sorry about the confusion, I didn't know about the # private class member.

As for the fix, I am not sure if tide is the right place. Tide grabs the prefix based on how the syntax-table is defined by the major mode like typescript-mode/js2-mode/js-mode etc. As of now # is marked as Punctuation, but I assume it should be changed to Symbol constituents. I checked php-mode for comparison, and it marks $ as a symbol. @josteink what do you think?

You can use the below workaround till we reach a conclusion.

(modify-syntax-entry ?# "_" typescript-mode-syntax-table)

@josteink
Copy link
Collaborator

josteink commented Oct 11, 2023

Sorry for the slow/no reply.

Typescript is now being supported by core emacs. If you are still having issues, feel free to report it to the GNU Emacs bug-tracker :)

Also I'm using eglot these days, and dont rely on a language-specific LSP implementation, so I don't have a valid tide-setup anymore either.

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

3 participants