-
Notifications
You must be signed in to change notification settings - Fork 511
Collapsible/expandable Functions, Regions, Comment blocks, and Comment based help blocks #1336
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
Comments
I believe VSCode recently introduced various folding features:
There are a number of similar user asks here:
There is currently some other work prioritised, but it looks like there are a few related pieces of functionality here that we should look into soon. |
I'm going to dupe this to #1276 😄 |
Actually this has the most info, so I'll make this the main one. |
@rjmholt I have looked at the links you posted however those shortcuts don't work with powershell which is my primary language I should have been a little more clear. I'm looking for the equivalent shortcut to "fold" as you call it, all regions in my code like in powershell ISE it's Ctrl-M. |
@Shane091490 You are correct. This is work we need to do to support this Folding Provider. We'll get to this as soon as we can! |
@Shane091490 FYI, you can already fold/unfold all regions in VSCode using Ctrl+K Ctrl+8 and Ctrl+K Ctrl+9. |
This is a work-in-progress
@tylerl0706 I've started a WIP PR for adding this. Will work on it when I can. |
Exciting!! We really need this 🎉 thank you so much |
This is a work-in-progress
Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the provider class
This commit adds detection of text regions bounded by braces { } and brackets ( ). This provides syntax aware folding for functions, arrays and hash tables.
This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@.
This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Function defintion blocks `<# ... #>` * Region bound comments `# region ... # endregion`
Previously the syntax folding was available for all users. However as this is a new feautre which depends on the grammar file which has been unreliable, it was decided to hide this feature behind a flag. The commit adds the logic to only active the syntax folding if the "syntax-folding" feature flag is set in the "powershell.developer.featureFlags" setting.
This commit fixes a minor tslint error in a comment line.
@tylerl0706 No longer WIP :-) |
@glennsarti Just catching up here - but does this mean there is a PowerShell folding provider available now? |
Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the provider class
This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables.
This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@.
This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion`
Previously the syntax folding was available for all users. However as this is a new feautre which depends on the grammar file which has been unreliable, it was decided to hide this feature behind a flag. The commit adds the logic to only active the syntax folding if the "syntax-folding" feature flag is set in the "powershell.developer.featureFlags" setting.
@mpearon If you really really want to try it, you can get an "in-progress" build e.g. https://ci.appveyor.com/project/PowerShell/vscode-powershell-cs82i/build/1.7.0-insiders-148/artifacts And yes, you'll need to add the appropriate feature flag ( |
Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the file, but not exported * Logging is added to help diagnose potential issues
This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables.
This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@.
This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion`
Previously the syntax folding was available for all users. However as this is a new feautre which depends on the grammar file which has been unreliable, it was decided to hide this feature behind a flag. The commit adds the logic to only active the syntax folding if the "syntax-folding" feature flag is set in the "powershell.developer.featureFlags" setting.
Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur.
@glennsarti Awesome! Grabbing the build now. :) |
@glennsarti It's working beautifully! A bit of an oddity, though - possibly expected in its current state. |
@mpearon Huh... Odd.. I've added the comments to the PR. Probably best to raise issues for PRs that are yet-to-be-merged in the PR itself. |
Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the file, but not exported * Logging is added to help diagnose potential issues
This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables.
This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@.
This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion`
Previously the syntax folding was available for all users. However as this is a new feautre which depends on the grammar file which has been unreliable, it was decided to hide this feature behind a flag. The commit adds the logic to only active the syntax folding if the "syntax-folding" feature flag is set in the "powershell.developer.featureFlags" setting.
Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur.
Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur.
Previously the syntax folding was available for all users. However it was able to be configured or turned off. This commit adds a new `codeFolding` settings section, with the syntax folding feature enabled by default.
Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur.
Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the file, but not exported * Logging is added to help diagnose potential issues
This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables.
This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@.
This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion`
Previously the syntax folding was available for all users. However it was able to be configured or turned off. This commit adds a new `codeFolding` settings section, with the syntax folding feature enabled by default.
Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur.
* (GH-1336) Add syntax aware folding provider Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the file, but not exported * Logging is added to help diagnose potential issues * (GH-1336) Add syntax folding for braces and parentheses This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables. * (GH-1336) Add syntax folding for here strings This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@. * (GH-1336) Add syntax folding for comments This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion` * (GH-1336) Add integration tests for the Folding Provider Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur. * (maint) Modify tslint configuration for test files Previously tslint was raising errors in Travis CI saying that the excluded test fixtures directory was not included in the project. This was by design however it appears to be a known bug palantir/tslint#3793. This commit removes the exclude for test files from linting and adds a tslint directive in the default index.ts file. A tslint directive is used instead of solving the issue because this is the default testing file for VS Code extesions and shouldn't really be modified unless absolutely necessary. In this instance it was safer for a tslint directive. * (GH-1336) Add Code Folding settings and enable by default Previously the syntax folding was available for all users. However it was able to be configured or turned off. This commit adds a new `codeFolding` settings section, with the syntax folding feature enabled by default. * add copyright headers
* (GH-1336) Add syntax aware folding provider Previously the Powershell extension used the default VSCode indentation based folding regions. This commit adds the skeleton for a syntax aware, client-side folding provider as per the API introduced in VSCode 1.23.0 * The client side detection uses the PowerShell Textmate grammar file and the vscode-text node module to parse the text file into tokens which will be matched in later commits. * However due to the way vscode imports the vscode-textmate module we can't simply just import it, instead we need to use file based require statements microsoft/vscode#46281 * This also means it's difficult to use any typings exposed in that module. As we only need one interface, this is replicated verbatim in the file, but not exported * Logging is added to help diagnose potential issues * (GH-1336) Add syntax folding for braces and parentheses This commit adds detection of text regions bounded by braces { } and parentheses ( ). This provides syntax aware folding for functions, arrays and hash tables. * (GH-1336) Add syntax folding for here strings This commit adds detection of text regions composed of single and double quoted here strings; @' '@ and @" "@. * (GH-1336) Add syntax folding for comments This commit adds syntax aware folding for comment regions * Contiguous blocks of line comments `# ....` * Block comments `<# ... #>` * Region bound comments `# region ... # endregion` * (GH-1336) Add integration tests for the Folding Provider Previously there were no tests to verify the folding provider. Due to the provider depending on 3rd party libraries (vscode-textmate and PowerShell grammar file) these tests will provide a degree of detection if breaking changes occur. * (maint) Modify tslint configuration for test files Previously tslint was raising errors in Travis CI saying that the excluded test fixtures directory was not included in the project. This was by design however it appears to be a known bug palantir/tslint#3793. This commit removes the exclude for test files from linting and adds a tslint directive in the default index.ts file. A tslint directive is used instead of solving the issue because this is the default testing file for VS Code extesions and shouldn't really be modified unless absolutely necessary. In this instance it was safer for a tslint directive. * (GH-1336) Add Code Folding settings and enable by default Previously the syntax folding was available for all users. However it was able to be configured or turned off. This commit adds a new `codeFolding` settings section, with the syntax folding feature enabled by default. * add copyright headers
Summary of the new feature
As a user I want to be able to collapse and expand Functions, Regions, Comment blocks, and Comment based help blocks. This helps me goto the section/region of code that I want to work on without having to scroll through thousands of lines of code to find the section I need.
I really like all the features in VS code however without this feature it is a deal breaker for me, I would rather use PS ISE or VS Community as they have this feature and makes my work much easier. I don't like having to scroll thru thousands of lines of code to find the section I need. I designed my tool with regions but I can't use them with VS code,
The text was updated successfully, but these errors were encountered: