Skip to content

Commit

Permalink
Merge pull request #21 from Cysharp/feature/DetectBuiltInAnalyzerSupport
Browse files Browse the repository at this point in the history
When using Visual Studio as script editor, hide the Analyzer Support checkbox.
  • Loading branch information
mayuki authored Nov 26, 2024
2 parents 6b2bdc2 + 6335cd4 commit 9b25479
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "CsprojModifier.Editor",
"rootNamespace": "",
"references": [],
"includePlatforms": [
"Editor"
Expand All @@ -25,6 +26,11 @@
"name": "com.unity.ide.vscode",
"expression": "1.2.0",
"define": "HAS_ROSLYN_ANALZYER_SUPPORT_VSCODE"
},
{
"name": "com.unity.ide.visualstudio",
"expression": "2.0.0",
"define": "HAS_ROSLYN_ANALZYER_SUPPORT_VS"
}
],
"noEngineReferences": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ public static bool HasRoslynAnalyzerIdeSupport
get
{

#if UNITY_2020_2_OR_NEWER && (HAS_ROSLYN_ANALZYER_SUPPORT_RIDER || HAS_ROSLYN_ANALZYER_SUPPORT_VSCODE)
// The editor extension for 'Rider' or 'Visual Studio Code' has the functionality to add Roslyn analyzer references.
#if UNITY_2020_2_OR_NEWER && (HAS_ROSLYN_ANALZYER_SUPPORT_RIDER || HAS_ROSLYN_ANALZYER_SUPPORT_VSCODE || HAS_ROSLYN_ANALZYER_SUPPORT_VS)
// The editor extension for 'Rider', 'Visual Studio Code' and 'Visual Studio' has the functionality to add Roslyn analyzer references.
var codeEditorType = Unity.CodeEditor.CodeEditor.CurrentEditor.GetType();
if (codeEditorType.Name == "VSCodeScriptEditor" || codeEditorType.Name == "RiderScriptEditor")
if (codeEditorType.Name == "VSCodeScriptEditor" || codeEditorType.Name == "RiderScriptEditor" || codeEditorType.Name == "VisualStudioEditor")
{
return true;
}
Expand Down

0 comments on commit 9b25479

Please sign in to comment.