James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.42k stars 519 forks source link

Intellisense autocompletion for derivative package #4258

Closed kevinbbbb closed 1 month ago

kevinbbbb commented 2 months ago

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • [x] The feature request has not been suggested in this repository.

The Missed*

Is your feature request related to a problem? Please provide a clear and concise description of what the problem is.

  • no Intellisense autocompletion is available for commands of the derivative package, which is a feature-rich package for writing derivatives, differentials etc.

The Solution*

Please provide a solution you would like to have.

  • add Intellisense autocompletion for the derivative package

Anything Else?

Add any other context about the feature request below.

James-Yu commented 1 month ago

It seems that we have an influx of requesting additional package intellisense. I am not sure how (and maybe what criteria) we shall handle them or design a future-proof mechanism on this matter. May I have your thoughts @jlelong ?

jlelong commented 1 month ago

@James-Yu Sorry for the delay, I missed this one. It is clearly not reasonable to add all package intellisense to LW. I think we should provide a mechanism for LW users to add extra package intellisense by themselves and make it persistent over LW update. It is sufficient to call https://github.com/James-Yu/LaTeX-Workshop/blob/73561d53ca1c84cbba2dded24fc78e369405ffb3/dev/pkgcommand.py on a .cwl file to obtain an intellisense file for LW.

Besides adding a new configuration variable to store user completion files, I am not completely sure how to proceed. Either describe the different steps in the wiki and keep our finger crossed not to have too many after sale issues. Or design a completely automatic mechanism, in which case it may simpler to create a new repo with all the package intellisense in LW format obtained from texsutdio after running pkgcommand.py.

kevinbbbb commented 1 month ago

I just tried to import the derivative.cwl file myself but I couldn't get the pkgcommand.py script to work. On first run, I got

python3 pkgcommand.py -i derivative.cwl -o ./
Traceback (most recent call last):
  File "/home/kevin/Latex_Workshop_Intellisense/pkgcommand.py", line 7, in <module>
    from pyintel import CwlIntel
ModuleNotFoundError: No module named 'pyintel'

which could be expected, since I don't have the pyintel package installed. So I tried to install the pyintel package, which is loaded at the beginning of the script. The install was not successful as i got

pip install pyintel
ERROR: Could not find a version that satisfies the requirement pyintel (from versions: none)
ERROR: No matching distribution found for pyintel

Web forums suggest that my Python version might not be compatible with the package. I have Python 3.10 installed. Unfortunately, I couldn't find any info on a package named pyintel but only a few similarily named packages.

Is the script you provided maybe outdated?

(I was not sure whether I should open a new issue, hoping it's okay.)

jlelong commented 1 month ago

The pyintel package is part of LW : https://github.com/James-Yu/LaTeX-Workshop/tree/master/dev/pyintel You need to copy the pyintel directory next to the pkgcommand.py script.

kevinbbbb commented 1 month ago

Thanks, I was now able to produce the JSON file and Intellisense is working for those commands! For the record, I followed your instructions given here.

James-Yu commented 1 month ago

30b74c1 should provide a temp solution to this issue. Users can now download all package intellisense jsons from this repo and place them to a folder, then include in latex-workshop.intellisense.package.dirs