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

Highlighting: improve C# queries #49686

Merged
merged 2 commits into from
Mar 20, 2023
Merged

Highlighting: improve C# queries #49686

merged 2 commits into from
Mar 20, 2023

Conversation

olafurpg
Copy link
Member

@olafurpg olafurpg commented Mar 20, 2023

Previously, the C# highlighting was missing a lot of identifier tokens and many tokens were getting unexpected SCIP SyntaxKind. This PR makes a fairly big change to the queries so that C# highlighting works more as expected, and more consistently with other languges like Java/C++.

CleanShot 2023-03-20 at 14 19 34@2x

Test plan

Updated snapshots.

A good place to visually confirm that C# highlighting works as expected is the snapshot testing directory from scip-dotnet https://sourcegraph.test:3443/github.com/sourcegraph/scip-dotnet/-/blob/snapshots/input/syntax/Main/Classes.cs

Previously, the C# highlighting was missing a lot of identifier tokens
and many tokens were getting unexpected SCIP `SyntaxKind`. This PR
makes a fairly big change to the queries so that C# highlighting works
more as expected, and more consistently with other languges like
Java/C++.
Copy link
Contributor

@tjdevries tjdevries left a comment

Choose a reason for hiding this comment

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

LGTM - low risk change since we're just updating the queries.

@olafurpg olafurpg enabled auto-merge (squash) March 20, 2023 13:41
@olafurpg olafurpg merged commit 5e2c3e7 into main Mar 20, 2023
@olafurpg olafurpg deleted the olafurpg/csharp-tweak branch March 20, 2023 14:01
@github-actions
Copy link
Contributor

The backport to 5.0 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.0 5.0
# Navigate to the new working tree
cd .worktrees/backport-5.0
# Create a new branch
git switch --create backport-49686-to-5.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5e2c3e74900a2953ce49dbc57a69a73a00039705
# Push it to GitHub
git push --set-upstream origin backport-49686-to-5.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.0

Then, create a pull request where the base branch is 5.0 and the compare/head branch is backport-49686-to-5.0.

@github-actions github-actions bot added backports failed-backport-to-5.0 release-blocker Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases labels Mar 20, 2023
olafurpg added a commit that referenced this pull request Mar 20, 2023
Previously, the C# highlighting was missing a lot of identifier tokens
and many tokens were getting unexpected SCIP `SyntaxKind`. This PR makes
a fairly big change to the queries so that C# highlighting works more as
expected, and more consistently with other languges like Java/C++.

![CleanShot 2023-03-20 at 14 19
34@2x](https://user-images.githubusercontent.com/1408093/226350969-ae71cb40-ba71-411d-b433-b3201d9c78c0.png)

Updated snapshots.

A good place to visually confirm that C# highlighting works as expected
is the snapshot testing directory from scip-dotnet
https://sourcegraph.test:3443/github.com/sourcegraph/scip-dotnet/-/blob/snapshots/input/syntax/Main/Classes.cs

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

(cherry picked from commit 5e2c3e7)
olafurpg added a commit that referenced this pull request Mar 20, 2023
Previously, the C# highlighting was missing a lot of identifier tokens
and many tokens were getting unexpected SCIP `SyntaxKind`. This PR makes
a fairly big change to the queries so that C# highlighting works more as
expected, and more consistently with other languges like Java/C++.

![CleanShot 2023-03-20 at 14 19
34@2x](https://user-images.githubusercontent.com/1408093/226350969-ae71cb40-ba71-411d-b433-b3201d9c78c0.png)

Updated snapshots.

A good place to visually confirm that C# highlighting works as expected
is the snapshot testing directory from scip-dotnet
https://sourcegraph.test:3443/github.com/sourcegraph/scip-dotnet/-/blob/snapshots/input/syntax/Main/Classes.cs

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

(cherry picked from commit 5e2c3e7)
olafurpg added a commit that referenced this pull request Mar 20, 2023
This PR is a manual backport of
https://github.com/sourcegraph/sourcegraph/pull/49686

The reason it's a manual backport is because we have landed a
non-backport PR that made minor changes to the snapshot testing format.
This PR is safe to backport because it only changes C# highlighting
queries, not any actual code. We decided it was worth backporting
because the C# highlighting improvements are significant and we expect
many customers are going to be trying out scip-dotnet, our new C#
indexer, over the next quarter.

## Test plan

See updated snapshot tests.
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
@camdencheek camdencheek added backported-to-5.0 and removed release-blocker Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases failed-backport-to-5.0 labels May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants