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

Inject regexp language into wildcard_constraints section params values #182

Closed
iromeo opened this issue Aug 12, 2019 · 3 comments · Fixed by #302
Closed

Inject regexp language into wildcard_constraints section params values #182

iromeo opened this issue Aug 12, 2019 · 3 comments · Fixed by #302
Assignees
Labels
codeInsight Code completion, resolve syntaxHighlighting Syntax highlighting
Milestone

Comments

@iromeo
Copy link
Contributor

iromeo commented Aug 12, 2019

Inject regexp language into wildcard_constraints section params values. Consider using PythonRegexpLanguage instead of default RegexpLanguage. Support both top-level and rule section declaration types.

@iromeo iromeo added codeInsight Code completion, resolve syntaxHighlighting Syntax highlighting labels Aug 12, 2019
@nikita-nazarov nikita-nazarov self-assigned this Aug 13, 2019
@iromeo iromeo added this to the 0.5.x milestone Sep 3, 2019
@iromeo iromeo modified the milestones: 0.5.x, 0.6.x Nov 20, 2019
@iromeo iromeo modified the milestones: 0.8.x, 0.8.1 Jul 13, 2020
@iromeo
Copy link
Contributor Author

iromeo commented Jul 13, 2020

Could be useful: SmkSLRegExpElementType or likely SmkSLInjector but inject PythonRegexpLanguage

@artemd24
Copy link
Contributor

artemd24 commented Aug 12, 2020

Wildcards are parsing by

def regex(filepattern):
    f = []
    last = 0
    wildcards = set()
    for match in _wildcard_regex.finditer(filepattern):
        f.append(re.escape(filepattern[last : match.start()]))
        wildcard = match.group("name")
        if wildcard in wildcards:
            if match.group("constraint"):
                raise ValueError(
                    "Constraint regex must be defined only in the first "
                    "occurence of the wildcard in a string."
                )
            f.append("(?P={})".format(wildcard))
        else:
            wildcards.add(wildcard)
            f.append(
                "(?P<{}>{})".format(
                    wildcard,
                    match.group("constraint") if match.group("constraint") else ".+",
                )
            )
        last = match.end()
    f.append(re.escape(filepattern[last:]))
    f.append("$")  # ensure that the match spans the whole file
    return "".join(f)

inside

    def regex(self):
        if self._regex is None:
            # compile a regular expression
            self._regex = re.compile(regex(self.file))
        return self._regex

@iromeo
Copy link
Contributor Author

iromeo commented Aug 21, 2020

image

iromeo added a commit that referenced this issue Dec 18, 2020
* dummy documentation for wrapper section

* completion for wrapper name with 0.63.0 version tag

* refactor wrapper completion code

* wrapper crawler, parser changes

* missed argument for wrappers inspection

* make crawler task cancelable, refactor storage code

* change deprecated application-component to plugin projectService

* change warning level to weak, improve parameters parser

* 1)Facet settings configurable for PyCharm added 2) facet detector when creating dir base project in PyCharm added 3) facet settings validator added

* wrapper arguments completion

* change crawler for test, tests WIP

* tests for wrapper args parsing

* change documentation popup

* bundle wrapper storage, update jvm in build.gradle to 1.4.0, change SmkWrapperStorage to moduleService

* fix typos in crawler

* fix tests for wrapper_section_completion

* tests for wrapper arguments completion

* tests for missed wrapper arguments

* Launch wrappers crawler during build process (not fully implemented, proof of concept)

* Wrappers bundle generation on jar task temporary disabled

* fix tests for wrapper name completion

* Classpath fixed for wrappers bundle gradle task + new alternative task impl added. Now is ok to use intellij API in SmkWrapperCrawler.kt

* update tests for wrapper documentation

* fix build script for bundled wrappers

* fix parsing bundled wrappers

* Not all folders are actually wrappers, e.g. `docs/_templates` isn't a wrapper. If folder doesn't contain `meta.yaml` it isn't a wrapper

* use case-insensitive wrapper ext check

* #257 warn of unspecified field arguments (#306)

* #196 warn of unexpected keyword arguments (#304)

* #198 warn of unexpected callable args (#305)

* restrict warning area from PyReferenceExpression to PyFunction

* #250 Warning correct using methods (#299)

Fixes: #250

* #182 Inject PythonRegExp language into wildcard_constraints section (#302)

Fixes #182

* #296 Implement CodeBlockProvider EP for snakemake (#309)

Fixes #296

* missed argument for wrappers inspection

* add description for changes

* remove duplicated declaration of inspection

* add "master" and "latest" options for version tag in completion

* fix links for documentation and source code of "master" and "latest" wrappers

* fix: Do not consider snakemake imports as section names, see #311

* fix: Do not consider other snakemake API as sections names, see #311

* cosmetics

* completion and crawler tests decoupled

* 1) generate test data with wrappers info from testdata/wrappers_storage folder, load test data in tests instead 2) build wrappers in 'build' dir, not src dir (tmp disabled)

* test data updated

* 1) workaround for #325 2) Fixed Confusing warning: Argument '' missed in params, resolves #326 3) completion contributors cleanup

* Generate wrappers info using `buildWrappersBundle` task

* Make wrappers missed args inspection name correspond to html + fix suppress id

* Chore: wrappers moved to 0.10.0 version

* Chore: Config for launch plugin with IDEA CE

* Chore: Wrappers repo path and version params extracted

* Tests: inspeciton name fixed

* Fixed: 1) hardcoded wrappers vers moved to SnakemakeAPI.kt 2) Fixed "apply" facet settings in PyCharm 3) Fixed validation for wrappers folder path 4) configurables renamed 5) messages updated 6) apply facets parsing/loading in bg

* Fixed: 1) Resolves #342 2) #325 3) Fixed facet settings serialziation/deserialization

Cleanup XML serialization for wrappers #325

Wrong wrapper name suggestion when using custom wrappers location #342

* Chore: missed file

* Tests: fixed

* Tests: 1) Fixed separators on windows 2) cbor lib updated

* cosmetics

Co-authored-by: Roman Chernyatchik <[email protected]>
Co-authored-by: Artem Davletov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codeInsight Code completion, resolve syntaxHighlighting Syntax highlighting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants