Skip to content

Commit

Permalink
(wip) todo
Browse files Browse the repository at this point in the history
  • Loading branch information
glennsarti committed Jul 10, 2018
1 parent 746b2e9 commit 8e23f89
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/features/Folding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,21 @@ export class FoldingProvider implements vscode.FoldingRangeProvider {
// If the grammar hasn't been setup correctly, return empty result
if (this.powershellGrammar == null) { return []; }

// Convert the document text into a series of grammar tokens
const tokens: ITokenList = this.powershellGrammar.tokenizeLine(document.getText(), null).tokens;
// Note that the tokenizeLine only considers LF as a line ending therefore the document
// content needs to be stripped. As VSCode only supports CRLF and LF line endings this
// is safe to do.
const content: string = document.getText().replace(/\r/g, " ");
const tokens: ITokenList = this.powershellGrammar.tokenizeLine(content, null).tokens;

// const tokens2: ITokenList = this.powershellGrammar.tokenizeLine(document.getText(), null).tokens;

// for (let i = 0; i < tokens.length; i++) {
// if (tokens[i].startIndex !== tokens2[i].startIndex) { console.log("startindex different at " + i.toString()) }
// if (tokens[i].endIndex !== tokens2[i].endIndex) { console.log("endIndex different at " + i.toString()) }
// if (tokens[i].scopes.toString() !== tokens2[i].scopes.toString()) { console.log("scopes different at " + i.toString()) }
// }

// console.log("");

// Parse the token list looking for matching tokens and return
// a list of LineNumberRange objects. Then filter the list and only return matches
Expand Down

0 comments on commit 8e23f89

Please sign in to comment.