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

Changing the module context rule as it doesn't highlight anything in VS Code #658

Conversation

rohennes
Copy link
Collaborator

@rohennes rohennes commented Oct 3, 2023

The rule to check for the presence of the :_content-type: in a module works but it doesn't show any line highlighting in VS Code. It only show the error on the cmd line.
This PR changes the rule to a tengo script, which highlights the first line of the file if it doesn't find the variable.

@rohennes rohennes added the OpenShiftAsciiDoc Issues with the OpenShiftAsciiDoc rule set only label Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

⚡️ Deploying PR Preview...

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Click here to review and test in web IDE: Contribute

@rohennes rohennes self-assigned this Oct 3, 2023
//add a newline, it might be missing
scope += "\n"

context_regex := ":_content-type:(\\s)?(CONCEPT|SNIPPET|ASSEMBLY|PROCEDURE|REFERENCE)"
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure the variable needs precisely one space after the variable name or AsciiDoctor complains

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
context_regex := ":_content-type:(\\s)?(CONCEPT|SNIPPET|ASSEMBLY|PROCEDURE|REFERENCE)"
context_regex := "^:_(mod-docs-)?content-type:\\s+(CONCEPT|SNIPPET|ASSEMBLY|PROCEDURE|REFERENCE)"

The modular-docs project recently changed the names of the attributes identifying the module type.

Copy link
Collaborator Author

@rohennes rohennes Oct 13, 2023

Choose a reason for hiding this comment

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

Thanks @jhradilek - I don't think OpenShift have yet implemented this change, but when it does, I will need to update this rule. (This rule set is OpenShift specific)

Copy link
Collaborator Author

@rohennes rohennes Oct 13, 2023

Choose a reason for hiding this comment

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

Pretty sure the variable needs precisely one space after the variable name or AsciiDoctor complains

Updated. Does this work @aireilly ?

Copy link
Member

Choose a reason for hiding this comment

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

IMO - if there is a failing on the VS Code plugin side, I would prefer to see that corrected rather than working around it with this update.

Copy link
Member

Choose a reason for hiding this comment

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

@rohennes rohennes force-pushed the module-context-using-tengo branch 2 times, most recently from 191fc5a to bea7e17 Compare October 16, 2023 14:41
@rohennes rohennes force-pushed the module-context-using-tengo branch 3 times, most recently from 13c3461 to c74cbde Compare December 1, 2023 14:23
…VS Code. Using tengo you can highlight first line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShiftAsciiDoc Issues with the OpenShiftAsciiDoc rule set only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants