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

fix: added missing keywords for highlighting #30

Merged
merged 6 commits into from
Mar 11, 2025

Conversation

rroutsong
Copy link
Contributor

@rroutsong rroutsong commented Oct 5, 2023

A lot of missing keywords for snakemake highlighting. Just added into 0.4.0 token lists.

Addresses some or all of issues #23, #18, #14, #22, #25

Summary by CodeRabbit

  • New Features

    • Introduced support for additional rule configuration options, including the new retries parameter.
    • Enhanced keyword recognition by adding pepfile, pepschema, and container to improve rule formatting and syntax highlighting.
  • Chores

    • Updated the application version from 0.4.1 to 0.5.0.

@rroutsong rroutsong changed the title Added missing keywords for highlighting Fix: added missing keywords for highlighting Oct 5, 2023
@rroutsong rroutsong changed the title Fix: added missing keywords for highlighting fix added missing keywords for highlighting Oct 5, 2023
@rroutsong rroutsong changed the title fix added missing keywords for highlighting fix Oct 5, 2023
@rroutsong rroutsong changed the title fix fix: added missing keywords for highlighting 5 minutes ago Oct 5, 2023
@rroutsong rroutsong changed the title fix: added missing keywords for highlighting 5 minutes ago fix: added missing keywords for highlighting Oct 6, 2023
@corneliusroemer
Copy link
Contributor

Oh you beat me to it, I opened #31 before seeing this. You're still missing 'retries'

@corneliusroemer
Copy link
Contributor

Easier to review if you just change this one file: https://github.com/snakemake/snakemake-lang-vscode-plugin/pull/24/files

@rroutsong
Copy link
Contributor Author

No worries, I am sure I missed a few more too I couldn't find a good extensive list of all keywords and their support or deprecation by version.

@corneliusroemer
Copy link
Contributor

Oh damn, I might be wrong, PR #24 doesn't seem to fix syntax highlighting. Have to dig a bit deeper, but thanks for giving this a go. We should figure out how to test it, that'd be useful!

@rroutsong
Copy link
Contributor Author

OK I am not so familiar with VScode extension development, so I might have borked it up. But I made this into a local vsix and distributed it to my group and it worked for our highlighting purposes.

@mbhall88
Copy link
Member

pepfile and pepschema also seem to be missing. Could you also add that to this PR?

@rroutsong
Copy link
Contributor Author

pepfile and pepschema also seem to be missing. Could you also add that to this PR?

added

Copy link

coderabbitai bot commented Mar 11, 2025

📝 Walkthrough

Walkthrough

The pull request updates the package version in the package.json file and modifies several configuration files related to Snakemake rule parameters. Changes include reordering parameters in a JSON file, adding a new parameter ("retries") in a YAML configuration, and updating regular expression patterns in multiple files to recognize new keywords ("pepfile" and "pepschema"). No modifications were made to the declarations of exported or public entities aside from the version update.

Changes

File(s) Change Summary
package.json Updated version from "0.4.1" to "0.5.0".
src/js/keywords-regex.json
src/keywords.yaml
Reordered rule parameters, added "retries" to the ruleparams section in YAML, and updated the "configs" and "functions" entries in JSON.
src/yaml/snakemake.language.yaml
syntaxes/snakemake.tmLanguage.json
languages/snakemake.json
Updated regex patterns to recognize the new keywords "pepfile" and "pepschema" without altering existing logic.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (2)
src/keywords.yaml (2)

14-16: 🛠️ Refactor suggestion

Duplicate Entry in Configs

The configs section lists the keyword pepschema twice. Removing the duplicate will help keep the configuration clean and unambiguous.


23-70: 🛠️ Refactor suggestion

Duplicate Keywords in Ruleparams

Within the ruleparams section, several keywords appear more than once (for example, container, notebook, default_target, handover, template_engine, and localrule). Duplicates in this list are unnecessary and may cause confusion for maintainers or downstream processing. It is recommended to deduplicate these entries to improve clarity and maintainability.

Suggested diff snippet:

-  - notebook
...
-  - default_target
-  - handover
...
-  - template_engine
...
-  - localrule

(Remove the redundant occurrences.)

🧹 Nitpick comments (4)
languages/snakemake.json (1)

96-102: Enhanced Regex Pattern for OnEnter Rules

The updated beforeText regex now incorporates additional keywords (e.g., container, shellcmd, name, norun, conda_env, container_img, is_containerized, etc.) needed for proper syntax highlighting. While the pattern is comprehensive, consider adding documentation or refactoring it into a more modular form if further keyword additions are anticipated.

src/yaml/snakemake.language.yaml (1)

38-45: Remove Duplicate Indentation Action

In the onEnterRules block, the action object mistakenly includes two indent: indent entries. Removing the redundant entry will simplify the configuration without affecting behavior.

Suggested diff:

-      indent: indent
- 
-      indent: indent
+      indent: indent
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 42-42: syntax error: could not find expected ':'

(syntax)

syntaxes/snakemake.tmLanguage.json (2)

27-27: Review Keyword Update for Configs Section

The regex pattern now includes the keyword module as intended. Please verify that this addition does not conflict with any existing syntax rules or usage elsewhere in the highlighting definitions.


46-46: Duplicate Keywords in Rule Parameters Pattern

The regex pattern for rule parameters contains duplicate keywords (e.g., notebook, template_engine, default_target, and handover appear twice). Removing these duplicates would simplify maintenance and improve readability. Consider revising the pattern as follows:

-  (benchmark|conda|container|shellcmd|name|norun|conda_env|container_img|is_containerized|env_modules|shadow_depth|docstring|notebook|template_engine|cache|path_modifier|handover|default_target|localrule|cwl|group|input|log|message|notebook|output|params|priority|resources|run|script|shadow|shell|singularity|threads|version|wildcard_constraints|wrapper|default_target|template_engine|handover)
+  (benchmark|conda|container|shellcmd|name|norun|conda_env|container_img|is_containerized|env_modules|shadow_depth|docstring|notebook|template_engine|cache|path_modifier|handover|default_target|localrule|cwl|group|input|log|message|output|params|priority|resources|run|script|shadow|shell|singularity|threads|version|wildcard_constraints|wrapper)

This will ensure each keyword appears only once and reduce any potential confusion in the highlighting rules.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba2658 and 224c802.

📒 Files selected for processing (21)
  • package.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • src/yaml/snakemake.language.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (2 hunks)
  • languages/snakemake.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (2 hunks)
  • src/yaml/snakemake.language.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (2 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
  • languages/snakemake.json (1 hunks)
  • src/yaml/snakemake.language.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
  • languages/snakemake.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • src/yaml/snakemake.language.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
src/yaml/snakemake.language.yaml

[error] 42-42: syntax error: could not find expected ':'

(syntax)

🔇 Additional comments (1)
package.json (1)

6-6: Version Bump Update

The version has been updated to "0.4.1", which properly reflects the release that includes the new highlighting keywords.

Copy link
Member

@dlaehnemann dlaehnemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (2)
src/keywords.yaml (2)

14-16: 🛠️ Refactor suggestion

Remove duplicate keyword "pepschema" in the configs section.

The list under configs contains "pepschema" twice (lines 15 and 16). This duplication might be unintended and could lead to ambiguity in processing or maintenance overhead. Please remove one occurrence.

-  - pepfile
-  - pepschema
-  - pepschema
+  - pepfile
+  - pepschema

65-70: 🛠️ Refactor suggestion

Eliminate duplicate entries in the ruleparams section.

The keywords listed after line 64 (including localrule, template_engine, default_target, and another set of localrule and template_engine) appear to be duplicates of entries already present in this section. Duplicate entries can lead to unexpected behavior in highlighting and increase maintenance complexity. It is recommended to remove the repeated keywords.

-  - localrule
-  - template_engine
-  - default_target
-  - localrule
-  - template_engine
🧹 Nitpick comments (1)
src/keywords.yaml (1)

23-49: Review existing duplicates in the ruleparams list.

Beyond the newly added duplicates (lines 65–70), the list already contains potential duplicates such as "container" (at lines 26 and 48) and "handover" (at lines 47 and later repeated at line 63). Although these may predate the current changes, it’s advisable to verify their necessity and remove any unintended repetition.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 224c802 and 7fe63c2.

⛔ Files ignored due to path filters (2)
  • CHANGELOG.md is excluded by !CHANGELOG.md
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (18)
  • package.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (2 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (2 hunks)
  • syntaxes/snakemake.tmLanguage.json (2 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
  • package.json (1 hunks)
  • src/js/keywords-regex.json (1 hunks)
  • src/keywords.yaml (1 hunks)
  • syntaxes/snakemake.tmLanguage.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (17)
  • package.json
  • src/keywords.yaml
  • syntaxes/snakemake.tmLanguage.json
  • src/keywords.yaml
  • syntaxes/snakemake.tmLanguage.json
  • syntaxes/snakemake.tmLanguage.json
  • src/keywords.yaml
  • src/keywords.yaml
  • syntaxes/snakemake.tmLanguage.json
  • src/js/keywords-regex.json
  • src/js/keywords-regex.json
  • package.json
  • syntaxes/snakemake.tmLanguage.json
  • syntaxes/snakemake.tmLanguage.json
  • src/js/keywords-regex.json
  • src/js/keywords-regex.json
  • src/js/keywords-regex.json
🔇 Additional comments (2)
src/keywords.yaml (2)

12-12: Approve addition of “module” in the configs section.

Adding the module keyword fills one of the missing parameters. This change looks good.


50-64: Validate the new ruleparams keywords.

New keywords such as shellcmd, name, norun, conda_env, container_img, is_containerized, env_modules, shadow_depth, docstring, notebook, template_engine, cache, path_modifier, handover, and default_target have been added. Please double-check that these keywords are in the intended order and that none of them conflict with existing definitions.

@bayraktar1 bayraktar1 self-assigned this Mar 11, 2025
@bayraktar1 bayraktar1 merged commit e623a48 into snakemake:master Mar 11, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Development

Successfully merging this pull request may close these issues.

6 participants