Skip to content

(GH-1413) Update grammar parsing for vscode-textmate v4 module #1414

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

Merged
merged 3 commits into from
Jul 10, 2018

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Jul 9, 2018

PR Summary

VS Code 1.25 has updated the imported vsode-textmate module from v3 to v4, which
introduced some breaking changes. This commit updates the grammar loader;

  • Uses a thenable grammar parser, as V4 of the module is all asynchronous

  • Uses a simple method detection technique on the Registry object to determine
    if we're using v3 or v4+ of the textmate module, and then branch the code
    accordingly.

    Note that this functionality can only be tested manually due to how the
    vscode-textmate module is incorporated into VSCode and the test-suite.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Previously the logging object had no interface which made testing difficult.
This commit adds a new interface which new features can use, which makes mocking
the logging object possible.
@glennsarti
Copy link
Contributor Author

Ping @rkeithhill

VS Code 1.25 has updated the imported vsode-textmate module from v3 to v4, which
introduced some breaking changes.  This commit updates the grammar loader;

* Uses a thenable grammar parser, as V4 of the module is all asynchronous
* Uses a simple method detection technique on the Registry object to determine
  if we're using v3 or v4+ of the textmate module, and then branch the code
  accordingly.

  Note that this functionality can only be tested manually due to how the
  vscode-textmate module is incorporated into VSCode and the test-suite.
@glennsarti glennsarti force-pushed the gh-1413-fix-for-textmate-v4 branch from fe2f631 to de00cf3 Compare July 9, 2018 09:16
@@ -1,15 +1,15 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import fs = require("fs");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think most of the rest of this codebase has a blank line after the copyright. Other than that LGTM. Thanks for fixing this!!

@rkeithhill
Copy link
Contributor

BTW would be good to get this PR merged soon as I have several PRs waiting on a clean run through the tests. :-)

@glennsarti glennsarti changed the title WIP (GH-1413) (GH-1413) Update grammar parsing for vscode-textmate v4 module (GH-1413) (GH-1413) Update grammar parsing for vscode-textmate v4 module Jul 9, 2018
@glennsarti glennsarti changed the title (GH-1413) (GH-1413) Update grammar parsing for vscode-textmate v4 module (GH-1413) Update grammar parsing for vscode-textmate v4 module Jul 9, 2018
@glennsarti
Copy link
Contributor Author

Removed WIP tag. The blank line can be fixed later

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

LGTM! I was about to do a full style review, but if @rkeithhill agrees, it might be better just to merge this and deal with style inconsistencies later

Add newline between copyright header and body
@rjmholt
Copy link
Contributor

rjmholt commented Jul 9, 2018

@glennsarti @rkeithhill I just added that newline. Will wait for your (second) approval to merge

@rkeithhill
Copy link
Contributor

@rjmholt Do you still have VSCode 1.24 installed? If so, could you test this on VSCode 1.24 to make sure the "conditional" code works?

@rkeithhill rkeithhill merged commit 5a62292 into PowerShell:master Jul 10, 2018
@rjmholt
Copy link
Contributor

rjmholt commented Jul 10, 2018

Looks like I can fold functions, foreach loop in VSCode 1.24 👍

glennsarti added a commit to glennsarti/vscode-powershell that referenced this pull request Jul 10, 2018
Previously in PR PowerShell#1414 the Folding provider was updated, however the promise
resolution was incorrect.  This caused the grammar load to never trigger the
Then command.  This commit instead uses the correct way to return the value
for the promise and, when then triggers the Then statement correctly.
rjmholt pushed a commit that referenced this pull request Jul 10, 2018
Previously in PR #1414 the Folding provider was updated, however the promise
resolution was incorrect.  This caused the grammar load to never trigger the
Then command.  This commit instead uses the correct way to return the value
for the promise and, when then triggers the Then statement correctly.
rjmholt pushed a commit that referenced this pull request Jul 11, 2018
* (maint) Add a logging interface

Previously the logging object had no interface which made testing difficult.
This commit adds a new interface which new features can use, which makes mocking
the logging object possible.

* (GH-1413) Update grammar parsing for vscode-textmate v4 module

VS Code 1.25 has updated the imported vsode-textmate module from v3 to v4, which
introduced some breaking changes.  This commit updates the grammar loader;

* Uses a thenable grammar parser, as V4 of the module is all asynchronous
* Uses a simple method detection technique on the Registry object to determine
  if we're using v3 or v4+ of the textmate module, and then branch the code
  accordingly.

  Note that this functionality can only be tested manually due to how the
  vscode-textmate module is incorporated into VSCode and the test-suite.

* Update Folding.ts

Add newline between copyright header and body
rjmholt pushed a commit that referenced this pull request Jul 11, 2018
Previously in PR #1414 the Folding provider was updated, however the promise
resolution was incorrect.  This caused the grammar load to never trigger the
Then command.  This commit instead uses the correct way to return the value
for the promise and, when then triggers the Then statement correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants