-
Notifications
You must be signed in to change notification settings - Fork 81
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
add unicode completions by latex name #1327
base: master
Are you sure you want to change the base?
Conversation
Change log updated here: |
I don't take any decisions over which PRs should or shouldn't be merged in this repository, but are you aware that the language server already provides the unicode symbols when you type the LaTeX name (or an emoji name), but starting with a backslash, i.e. like in actual LaTeX or in the Julia REPL? LanguageServer.jl/src/requests/completions.jl Lines 53 to 56 in 0da181a
Also I think it is quite common to use the greek letter names written in ASCII as variable names (like |
Thanks for the comment! Yes, I'm aware about it but its not what this PR is about (sorry, I think my description is not clear enough in this regard) This PR actually tries to do something different: The completion only occurs, when an existing symbol already exists, so just typing The very first symbol needs to be typed using the latex-backslash way. However, having to use the latex-backslash all of the time slows you down quite a bit (in my experience), thats why I usually stop using unicode symbols all together and just use ASCII after a while (which is a shame, because I think its a really nice feature!) I'm open for comments and feedback because this is a very opinionated change (maybe it would make sense to have a preference toggle for it). |
Okay I understand now, thanks for the explanation. Then I guess it could be something useful. Maybe it should do another check to not provide this unicode conversion if there is also an existing symbol with the corresponding ASCII name already defined. Though that would probably be a quite bad and confusing code style if names like e.g. |
Thanks for pointing it out, it was not clear in the initial description. Good point, that could be confusing. Actually, I think some kind of ranking/suggestion for the completion suggestion would make sense overall but is not implemented from what I saw. |
Feature: Unicode variable completion by latex name (WIP)
This PR adds the ability to work with variables that use unicode symbols as names more conveniently. As an example consider there exists a variable
θ₀
. With this PR, the symbolθ₀
would be added to code completion suggestions if the user types a string close totheta_0
(which is easier on keyboards that dont feature greek characters)Principle:
θ₀
would result intheta_0
, because the latex command to type it is:\theta\_0
xyz_θ
would result inxyz_theta
Demo:
Screen.Recording.2024-10-09.at.10.41.16.mov
For every PR, please check the following: