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

Code folder uses sub-optimal conventions and processes #824

Closed
glennsarti opened this issue Dec 14, 2018 · 0 comments
Closed

Code folder uses sub-optimal conventions and processes #824

glennsarti opened this issue Dec 14, 2018 · 0 comments
Labels
Area-Folding Issue-Enhancement A feature request (enhancement).

Comments

@glennsarti
Copy link
Contributor

The syntax aware code folder was initially adapted from the Typescript version. However when porting to C# the behaviour was correct but the implementation was slow and created many objects.

This ticket tracks the effort to speed up the code folding provider.

glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 14, 2018
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 14, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 15, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 15, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 16, 2018
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 16, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 16, 2018
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
@SydneyhSmith SydneyhSmith added Area-Folding Issue-Enhancement A feature request (enhancement). labels Dec 18, 2018
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 21, 2018
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 21, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 21, 2018
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 23, 2018
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 23, 2018
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 7, 2019
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 7, 2019
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 7, 2019
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 7, 2019
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 7, 2019
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 8, 2019
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 8, 2019
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 8, 2019
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 12, 2019
…o it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 12, 2019
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 12, 2019
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 12, 2019
Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Jan 12, 2019
Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
TylerLeonhardt pushed a commit that referenced this issue Jan 15, 2019
* (maint) Add tests for code folding for PowerShell classes

Previously there were no tests for PowerShell classes.  This commit adds a simple
test for this scenario to ensure future changes do not break folding.

* (GH-824) Refactor the FoldingReference arrays and lists into it's own class

Previously the folding provider created many intermediate arrays and lists and
required post-processing.  This commit changes the behaviour to use an
accumlator patter with an extended Dictionary class.  This new class adds a
`SafeAdd` method to add FoldingRanges, which then has the logic to determine if
the range should indeed be added, for example, passing nulls or pre-existing
larger ranges.

By passing around this list using ByReference we can avoid creating many objects
which are just then thrown away.

This commit also moves the ShowLastLine code from the FoldingProvider into the
Language Server.  This reduces the number of array enumerations to one.

* (GH-824) Refactor Token Folding Operations

Previously each token type detection was separated into discrete blocks
to make reading the code easier. However this meant there were many
enumerations of the Tokens array as well as passing around intermediate
arrays/lists.  This commit takes the individual methods and overlaps them
to reduce the number of enumerations and regular expression matching to
a minimum.

Note that there are considerable code comments here due to the code now
being more complex on initial review.

* (GH-812) Update folder for DSC style scripts

Previously the code folding was not tested against DSC configuration scripts.
This commit adds tests for a sample DSC script to ensure the folding occurs at the correct
places

* (GH-824) More strict block comment folding detection

Previously the folder would search for the region markers without case sensitivity.
This commit modifies the regular expressions to be more strict on the what
is a region marker and adds a negative test to ensure that regions that are not
cased correctly are not folded .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Folding Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

2 participants