-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SLVS-1510 Add IEmbeddedRoslynAnalyzerProvider & IConnectedModeRoslynA…
…nalyzerProvider (#5749) [SLVS-1510](https://sonarsource.atlassian.net/browse/SLVS-1510) [SLVS-1510]: https://sonarsource.atlassian.net/browse/SLVS-1510?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
1 parent
c0136c5
commit 0255496
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/Infrastructure.VS/Roslyn/IConnectedModeRoslynAnalyzerProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SonarLint for Visual Studio | ||
* Copyright (C) 2016-2024 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
using System.Collections.Immutable; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using SonarLint.VisualStudio.Core.Binding; | ||
|
||
namespace SonarLint.VisualStudio.Infrastructure.VS.Roslyn; | ||
|
||
public interface IConnectedModeRoslynAnalyzerProvider | ||
{ | ||
/// <summary> | ||
/// Returns SonarAnalyzer.CSharp & SonarAnalyzer.VisualBasic analyzer DLLs that are downloaded from the server for the current binding | ||
/// </summary> | ||
ImmutableArray<AnalyzerFileReference>? GetOrNull(ServerConnection connection); | ||
/// <summary> | ||
/// Provides updates about the analyzers for a given connection | ||
/// </summary> | ||
/// <remarks> | ||
/// Internally this reacts to SLCore synchronization and updates to the cached Connected Mode analyzers | ||
/// </remarks> | ||
event EventHandler<AnalyzerUpdatedForConnectionEventArgs> AnalyzerUpdatedForConnection; | ||
} | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class AnalyzerUpdatedForConnectionEventArgs(ServerConnection connection, ImmutableArray<AnalyzerFileReference>? analyzers) : EventArgs | ||
{ | ||
public ServerConnection Connection { get; } = connection; | ||
public ImmutableArray<AnalyzerFileReference>? Analyzers { get; } = analyzers; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Infrastructure.VS/Roslyn/IEmbeddedRoslynAnalyzerProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* SonarLint for Visual Studio | ||
* Copyright (C) 2016-2024 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
using System.Collections.Immutable; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
|
||
namespace SonarLint.VisualStudio.Infrastructure.VS.Roslyn; | ||
|
||
public interface IEmbeddedRoslynAnalyzerProvider | ||
{ | ||
/// <summary> | ||
/// Returns SonarAnalyzer.CSharp & SonarAnalyzer.VisualBasic analyzer DLLs that are embedded in the VSIX | ||
/// </summary> | ||
ImmutableArray<AnalyzerFileReference> Get(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters