JetBrains/requirements

Support highlighting of extra options

Opened this issue · 0 comments

Describe the bug

As described in https://pip.pypa.io/en/stable/reference/requirements-file-format/, it is possible to pass additional options to individual packages in requirements.txt files.

For example, this is valid (and works):

# in requirements.txt

--install-option="--no-deps" <package>; python_version >= "3.7"

Currently, the options specified before the package are marked as syntax errors.

To Reproduce
Steps to reproduce the behavior:

  1. Define any package in a requirements.txt file.
  2. Add an option for permitted values (see above link in description)
  3. Run pip install -r requirements.txt
  4. See there is no error installing the package as specified by options, but highlighting in PyCharm indicates a syntax error.

Expected behavior

Highlighting should correctly parse the options and not report syntax errors.

Optionally, it could display the options in a different color, similarly to how python_version and sys_platform are highlighted.
This could help visualize the package name quickly.

Screenshots

image

IDE (please complete the following information. See Main Menu -> Help -> About):

  • OS: Ubuntu 20.04
  • Product: PyCharm Professional
  • Version: 2022.2.2 Build #PY-222.4167.33, built on September 15, 2022
  • JRE Version: Runtime version: 17.0.4+7-b469.53 amd64, VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
  • Project SDK: Python 3.7 to 3.10

Plugin (please complete the following information. See Main Menu -> File -> Settings -> Plugins):

  • Version 2022.3-222-EAP-SNAPSHOT

Additional context
n/a