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

Fix for incorrect highlighting in verbatim strings #13664

Merged
merged 1 commit into from Mar 21, 2024
Merged

Conversation

anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Mar 20, 2024

I noticed the following Bicep code was being highlighted incorrectly in VSCode + GitHub:

// evaluates to '\'abc\''
var multilineExtraQuotes = ''''abc''''
// evaluates to '\'\nabc\n\''
var multilineExtraQuotesNewlines = ''''
abc
''''
var multilineSingleLine = '''hello!'''

This PR fixes that and adds a baseline for it.

Previews visible here:
http://htmlpreview.github.io/?https://raw.githubusercontent.com/Azure/bicep/ant/grammar/src/monarch/test/baselines/strings.html
http://htmlpreview.github.io/?https://raw.githubusercontent.com/Azure/bicep/ant/grammar/src/highlightjs/test/baselines/strings.html
http://htmlpreview.github.io/?https://raw.githubusercontent.com/Azure/bicep/ant/grammar/src/textmate/test/baselines/strings.html

Microsoft Reviewers: Open in CodeFlow

@anthony-c-martin anthony-c-martin force-pushed the ant/grammar branch 2 times, most recently from 45bb5c2 to 5e7505f Compare March 20, 2024 12:13
Copy link
Contributor

github-actions bot commented Mar 20, 2024

Test this change out locally with the following install scripts (Action run 8375914687)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 8375914687
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 8375914687"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 8375914687
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 8375914687"

Copy link
Contributor

github-actions bot commented Mar 20, 2024

Test Results

    66 files   -     33      66 suites   - 33   22m 28s ⏱️ - 21m 38s
10 694 tests  -     20  10 692 ✅  -     20  2 💤 ±0  0 ❌ ±0 
25 278 runs   - 12 635  25 274 ✅  - 12 633  4 💤  - 2  0 ❌ ±0 

Results for commit ad13487. ± Comparison against base commit 96f6c3a.

♻️ This comment has been updated with latest results.

Comment on lines +5 to +18
export const baselineRecordEnabled = (process.env['BASELINE_RECORD']?.toLowerCase() === 'true');

export async function expectFileContents(filePath: string, contents: string) {
if (baselineRecordEnabled) {
await mkdir(path.dirname(filePath), { recursive: true });
await writeFile(filePath, contents, 'utf-8');
} else {
// If these assertions fail, use 'npm run test:fix' to replace the baseline files
expect(existsSync(filePath)).toBeTruthy();

const readContents = await readFile(filePath, { encoding: 'utf8' });
expect(contents).toBe(readContents);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic copied from the bicep-types repo, just to simplify updating of baselines.

@anthony-c-martin anthony-c-martin merged commit c872330 into main Mar 21, 2024
44 checks passed
@anthony-c-martin anthony-c-martin deleted the ant/grammar branch March 21, 2024 13:37
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.

None yet

2 participants