Fix 63749 - Markdown, U+2028, and "Go to Symbol in File..." (#63936)

* fix-63749 - Added UNICODE_NEWLINE_REGEX

* fix-63749 - Removed .skip for the test method

* fix-63749 Moved Replace to parse
This commit is contained in:
Prabhanjan S Koushik
2018-11-29 22:39:36 +05:30
committed by Matt Bierner
parent de4c52a612
commit e05aa178d6
2 changed files with 3 additions and 2 deletions

View File

@@ -109,13 +109,14 @@ export class MarkdownEngine {
}
public async parse(document: vscode.Uri, source: string): Promise<Token[]> {
const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
const { text, offset } = this.stripFrontmatter(source);
this.currentDocument = document;
this._slugCount = new Map<string, number>();
const engine = await this.getEngine(document);
return engine.parse(text, {}).map(token => {
return engine.parse(text.replace(UNICODE_NEWLINE_REGEX, ''), {}).map(token => {
if (token.map) {
token.map[0] += offset;
token.map[1] += offset;

View File

@@ -83,7 +83,7 @@ suite('markdown.DocumentSymbolProvider', () => {
assert.strictEqual(symbols[0].children[1].name, '## h3');
});
test.skip('Should handle line separator in file. Issue #63749', async () => {
test('Should handle line separator in file. Issue #63749', async () => {
const symbols = await getSymbolsForFile(`# A
- foo