Add `.slnx` to XML extensions by kasperk81 · Pull Request #7084 · github-linguist/linguist · GitHub
Skip to content

Add .slnx to XML extensions#7084

Merged
lildude merged 8 commits into
github-linguist:mainfrom
kasperk81:patch-2
Jun 2, 2025
Merged

Add .slnx to XML extensions#7084
lildude merged 8 commits into
github-linguist:mainfrom
kasperk81:patch-2

Conversation

@kasperk81

@kasperk81 kasperk81 commented Oct 9, 2024

Copy link
Copy Markdown
Contributor

Description

Checklist:

Fix #7083

@kasperk81 kasperk81 requested a review from a team as a code owner October 9, 2024 15:49
@kasperk81

Copy link
Copy Markdown
Contributor Author

@kasperk81

Copy link
Copy Markdown
Contributor Author

fyi @rainersigwald @davkean (dotnet/msbuild#1730 (comment) it was simpler than i thought 😉)

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ah yeah, getting the default XML highlighting is a great low-cost way to do this!

@Alhadis Alhadis changed the title Recognize .slnx as XML Add .slnx to XML extensions Oct 9, 2024

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your sample should be in the samples/XML directory.

@kasperk81

Copy link
Copy Markdown
Contributor Author

@lildude ok, but can you tell me why? there is an existing .sln, i'm adding .slnx next to it https://github.com/github-linguist/linguist/tree/main/samples/Microsoft%20Visual%20Studio%20Solution
this is from vs library open sourced last week https://github.com/microsoft/vs-solutionpersistence (handles both .sln and .slnx)

@lildude

lildude commented Oct 14, 2024

Copy link
Copy Markdown
Member

@lildude ok, but can you tell me why?

Sure... it's what you want 😉

Screenshot 2024-10-14 at 17 52 58

As you're adding the extension to the XML language entry, you're saying these files are XML and should be highlighted as XML and as such, the sample needs to go into the XML language directory. This is why the tests were failing.

@kasperk81

Copy link
Copy Markdown
Contributor Author

Ah, I didn't realize that the samples are structured per language, and "Microsoft Visual Studio Solution" is treated as a language. The new format, however, is based on the XML language. :)

@lildude

lildude commented Oct 14, 2024

Copy link
Copy Markdown
Member

You need to add this to the list of no-root-tag entries in the test too:

def test_xml
no_root_tag = [
"#{samples_path}/XML/libsomething.dll.config",
"#{samples_path}/XML/real-estate.mjml",
"#{samples_path}/XML/XmlIO.pluginspec",
"#{samples_path}/XML/MainView.ux",
"#{samples_path}/XML/MyApp.ux",
"#{samples_path}/XML/xhtml-struct-1.mod",
"#{samples_path}/XML/wixdemo.wixproj",
"#{samples_path}/XML/msbuild-example.proj",
"#{samples_path}/XML/sample.targets",
"#{samples_path}/XML/Default.props",
"#{samples_path}/XML/racoon.mjml",
"#{samples_path}/XML/some-ideas.mm",
"#{samples_path}/XML/GMOculus.project.gmx",
"#{samples_path}/XML/obj_control.object.gmx",
"#{samples_path}/XML/MainView.axaml"
]
assert_all_xml all_xml_fixtures("*") - no_root_tag

This will exclude the sample from the XML strategy testing which is what is failing here (we're not using the strategy to detect the language).

@lildude lildude dismissed their stale review October 14, 2024 18:03

All good now. I'll review usage again when I start preparing the next release.

@kasperk81

Copy link
Copy Markdown
Contributor Author

@lildude the search indicator is only going to improve significantly until dotnet/sdk#40913 is resolved (support for slnx in dotnet sdk which is scheduled for .NET 9 release 2 which usually happen at the end of Feb). Rest assured, it is happening; the whole community was waiting for new solution format for a very long time dotnet/msbuild#1730 and VS has just added its support (as a preview feature).

@edvilme

edvilme commented Feb 26, 2025

Copy link
Copy Markdown

Hello @lildude just wondering if you and your team had had the chance of taking a look into this. .NET 9.0.200 has been out now and the use of .slnx files has increased in popularity

@lildude

lildude commented Feb 27, 2025

Copy link
Copy Markdown
Member

Hello @lildude just wondering if you and your team had had the chance of taking a look into this.

No. I only review pending popularity PRs when I make a new release which happens approximately every 3-4 months.

@kasperk81

Copy link
Copy Markdown
Contributor Author

@edvilme i hope visual studio will take this out of preview so more people can join. today everyone in a team has to enable preview feature to even get slnx open the solution in vs which i think is holding back the masses

@kasperk81

Copy link
Copy Markdown
Contributor Author

numbers are steadily growing. what's the popularity criteria of adding an extension to existing language, with no conflict? is it a fixed value?

@kasperk81

Copy link
Copy Markdown
Contributor Author

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks.

Important

The changes in this PR will not appear on GitHub until the next release has been made and deployed. See here for more details.

@lildude lildude added this pull request to the merge queue Jun 2, 2025
Merged via the queue into github-linguist:main with commit b854c47 Jun 2, 2025
5 checks passed
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slnx - new visual studio xml solution format

4 participants