SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 366 forks source link

"Filling in" the suggestion pop-up #1020

Open diego898 opened 7 years ago

diego898 commented 7 years ago

This issue mirrors the one I made on the LaTeX-cwl project: https://github.com/LaTeXing/LaTeX-cwl/issues/6

I am unsure if latexing is still being developed, or if at some point latextools will want to replace latex-cwl with its own version.

r-stein commented 7 years ago

That's a side-effect of setting the auto-complete to a mininum width here. It might be the best to undo that change.

r-stein commented 7 years ago

PS. LaTeX-cwl only hosts the cwl files. LaTeXTools parses them and provides the auto completion.

diego898 commented 7 years ago

ah - so I should delete the corresponding issue over there? Also - Would you suggest I make a change myself to fix this? If so, where? Or will it be fixed within latextools itself? Thanks!

r-stein commented 7 years ago

You can just delete the mentioned line. If we fix this #790 will occur again so I am not sure whether wie fix it. However I would vote to fix this and not force a minimal auto complete size.

diego898 commented 7 years ago

Hm I went ahead and deleted that line, and it the popup now displays but Im getting the following behavior:

Notice, for some reason selecting \longleftarrowplaces it without the actual backslash now in both regular and math mode

r-stein commented 7 years ago

Okay I wondered about that behavior. Thanks for that hint, that it is related to ljust. Change this line

to

(c[0], c[1][1:]) if c[1].startswith("\\") and "${" in c[1] else c
diego898 commented 7 years ago

Thanks @r-stein, that fixed it for me.

So to summarize, in order for me to fix the issues that came up in this post I had to make the following changes to latex_cwl_completions.py

ig0774 commented 7 years ago

Let's leave this open until we have a working solution in the am actual release.

One thing that might get the advantages of both approaches is to apply the left-justification only to the first entry in the results (this would have to be moved elsewhere). We could even try making the size of the padding configurable, since the size might depend on the environment is run in.

r-stein commented 7 years ago

One thing that might get the advantages of both approaches is to apply the left-justification only to the first entry in the results

This would result in a autocomplete, that shrinks after you type a few characters and the first entry disappears. I think this issue is more important than the other one, so I vote for fixing this and search for a way to fix both.

diego898 commented 7 years ago

Quick question - when latextools is updated in the future, what will happen to me since I've changed my local installation? I guess package control will return an error and then I can just uninstall/reinstall?

r-stein commented 7 years ago

If the file is changed by the update it will be overwritten.

diego898 commented 7 years ago

ah I thought package control might not like that - got it thanks!

diego898 commented 7 years ago

Hello again! Sorry about this, but even after making the above changes, I see that the clipping is still happening, but it seems to only be happening with the suggestions of \newcommand I've defined in a custom file.

r-stein commented 7 years ago

You need to change this file and maybe the next line to

return (s + "\tlocal", comp[1:] if comp.startswith("\\") and "${" in comp else comp)
diego898 commented 7 years ago

Sorry @r-stein when you say I need to change that file/line do you mean I need to change that line to what you suggested? I am unclear because you said"and maybe the next line", which suggests I need to change that file (to what?) in addition to changing the return line. If I take that interpretation, I understand it to mean that I DELETE that line, AND CHANGE the return line to what you suggested. Is this correct?

r-stein commented 7 years ago

Yes the line I suggested and maybe the next line (I am not sure about that).

diego898 commented 7 years ago

I've only deleted that line, and it seems to work fine right now. I will report back if anything! Thanks!