From 78c960de89a1540818d2a6739199ae1e7d7f4a13 Mon Sep 17 00:00:00 2001 From: Shenglong Li Date: Mon, 10 Aug 2026 13:08:39 -0700 Subject: [PATCH 1/2] Align language server namespaces with folders Update namespaces after the feature-oriented language server refactor and repair dependent imports and qualified type references. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../SourceArchiveTests.cs | 1 - .../BicepTestConstants.cs | 2 +- .../IServiceCollectionExtensions.cs | 6 ++-- .../Syntax/SyntaxModifierTests.cs | 2 +- .../CodeLensTests.cs | 3 +- .../CompletionTests.cs | 3 +- .../SnippetCompletionTestHelper.cs | 2 +- .../DeployBicepFileActionTest.cs | 17 +++++----- .../ExpressionAndTypeExtractorTests.cs | 2 +- .../GenerateParamsCommandTests.cs | 2 +- .../Helpers/LanguageServerHelper.cs | 2 +- .../HoverTests.cs | 1 - .../ImportKubernetesManifestTests.cs | 2 +- .../InsertResourceCommandTests.cs | 3 +- .../LangServerScenarioTests.cs | 2 +- .../Registry/ModuleRestoreSchedulerTests.cs | 4 +-- .../TelemetryTests.cs | 2 +- .../TypeStringifierTests.cs | 2 +- .../BicepCompilationManagerHelper.cs | 5 ++- .../BicepCompilationManagerTests.cs | 4 +-- .../BicepCompilationProviderTests.cs | 2 +- .../BicepCompletionProviderTests.cs | 7 ++-- .../BicepExternalSourceRequestHandlerTests.cs | 4 +-- .../BicepCompletionContextTests.cs | 2 +- .../Completions/CompletionItemBuilderTests.cs | 2 +- .../ModuleReferenceCompletionProviderTests.cs | 5 ++- .../ResourceTypeSearchKeywordsTests.cs | 4 +-- .../BicepConfigChangeHandlerTests.cs | 3 +- .../Configuration/ConfigurationHelperTests.cs | 1 - .../Configuration/JsonEditorTests.cs | 2 +- .../Deploy/DeploymentHelperTests.cs | 2 +- .../Deploy/DeploymentParametersHelperTests.cs | 4 +-- .../Handlers/BicepBuildCommandHandlerTests.cs | 4 +-- .../Handlers/BicepCodeActionHandlerTests.cs | 5 +-- .../BicepDecompileCommandHandlerTests.cs | 4 +-- ...eForPasteBicepParamsCommandHandlerTests.cs | 4 +-- ...cepDecompileForPasteCommandHandlerTests.cs | 4 +-- ...BicepDecompileParamsCommandHandlerTests.cs | 2 +- .../BicepDeploymentParametersHandlerTests.cs | 4 +-- ...BicepDeploymentScopeRequestHandlerTests.cs | 6 ++-- ...BicepDeploymentStartCommandHandlerTests.cs | 8 ++--- .../BicepEditLinterRuleCommandHandlerTests.cs | 4 +-- ...pExternalSourceDocumentLinkHandlerTests.cs | 4 +-- ...pForceModulesRestoreCommandHandlerTests.cs | 4 +-- ...etRecommendedConfigLocationHandlerTests.cs | 2 +- .../BicepSemanticTokensHandlerTests.cs | 2 +- .../BicepTextDocumentSyncHandlerTests.cs | 6 ++-- .../Helpers/CompilationHelperTests.cs | 1 + .../Mocks/LanguageServerMock.cs | 2 +- .../Snippets/SnippetCacheTests.cs | 2 +- .../Snippets/SnippetTests.cs | 2 +- .../Snippets/SnippetsProviderTests.cs | 4 +-- .../Telemetry/TelemetryHelperTests.cs | 2 +- .../BicepConfigLifecycleManager.cs | 6 ++-- .../IBicepConfigLifecycleManager.cs | 2 +- .../ClientCapabilitiesProvider.cs | 6 ++-- .../IClientCapabilitiesProvider.cs | 2 +- .../Compilation/BicepCompilationManager.cs | 8 ++--- .../Compilation/BicepCompilationProvider.cs | 5 ++- .../Compilation/CompilationContext.cs | 6 ++-- .../Compilation/CompilationContextBase.cs | 2 +- .../Compilation/ICompilationManager.cs | 2 +- .../Compilation/ICompilationProvider.cs | 3 +- .../Compilation/UnsafeCompilationContext.cs | 2 +- .../Custom/Build/BicepBuildCommandHandler.cs | 4 +-- .../Build/BicepBuildParamsCommandHandler.cs | 4 +-- .../BicepCreateConfigFileHandler.cs | 5 +-- ...icepGetRecommendedConfigLocationHandler.cs | 4 +-- .../Decompile/BicepDecompileCommandHandler.cs | 4 +-- .../BicepDecompileForPasteCommandHandler.cs | 4 +-- .../BicepDecompileParamsCommandHandler.cs | 2 +- .../BicepDecompileSaveCommandHandler.cs | 6 ++-- .../BicepDeploymentParametersHandler.cs | 4 +-- .../BicepDeploymentScopeRequestHandler.cs | 8 ++--- .../BicepDeploymentStartCommandHandler.cs | 9 +++--- ...ploymentWaitForCompletionCommandHandler.cs | 6 ++-- .../Deployments/GetDeploymentDataHandler.cs | 5 +-- .../CredentialFromTokenAndTimeStamp.cs | 2 +- .../Services/DeploymentCollectionProvider.cs | 2 +- .../DeploymentFileCompilationCache.cs | 10 +++--- .../Deployments/Services/DeploymentHelper.cs | 4 +-- .../Services/DeploymentOperationsCache.cs | 2 +- .../Services/DeploymentParametersHelper.cs | 6 ++-- .../Services/IDeploymentCollectionProvider.cs | 2 +- .../IDeploymentFileCompilationCache.cs | 6 ++-- .../Deployments/Services/IDeploymentHelper.cs | 4 +-- .../Services/IDeploymentOperationsCache.cs | 2 +- .../Deployments/Services/ParameterType.cs | 2 +- .../Services/ParametersFileUpdateOption.cs | 2 +- .../ImportKubernetesManifestHandler.cs | 4 +-- .../InsertResource/AzResourceProvider.cs | 2 +- .../InsertResource/IAzResourceProvider.cs | 2 +- .../InsertResource/InsertResourceHandler.cs | 7 ++-- .../BicepEditLinterRuleCommandHandler.cs | 9 +++--- .../Custom/LocalDeploy/LocalDeployHandler.cs | 4 +-- .../BicepForceModulesRestoreCommandHandler.cs | 4 +-- .../ModuleRestore/IModuleRestoreScheduler.cs | 4 +-- .../ModuleRestore/ModuleRestoreScheduler.cs | 4 +-- .../BicepGenerateParamsCommandHandler.cs | 4 +-- .../Custom/Telemetry/BicepTelemetryEvent.cs | 2 +- .../Custom/Telemetry/BicepTelemetryHandler.cs | 3 +- .../Custom/Telemetry/ITelemetryProvider.cs | 2 +- .../TelemetryAndErrorHandlingHelper.cs | 3 +- .../Custom/Telemetry/TelemetryConstants.cs | 2 +- .../Custom/Telemetry/TelemetryHelper.cs | 2 +- .../Custom/Telemetry/TelemetryProvider.cs | 2 +- .../Visualization/VisualGraphBuilder.cs | 2 +- .../Visualization/VisualGraphUpdateHandler.cs | 2 +- .../CodeAction/BicepCodeActionHandler.cs | 22 ++++++------- .../Language/CodeAction/CodeFixWithCommand.cs | 4 +-- .../CodeAction/ExpressionAndTypeExtractor.cs | 14 ++++---- .../Language/CodeAction/TypeStringifier.cs | 2 +- .../Language/CodeLens/BicepCodeLensHandler.cs | 6 ++-- .../ExternalSourceCodeLensProvider.cs | 13 ++++---- .../AzureContainerRegistriesProvider.cs | 2 +- .../Completion/BicepCompletionContext.cs | 6 ++-- .../Completion/BicepCompletionContextKind.cs | 2 +- .../Completion/BicepCompletionHandler.cs | 7 ++-- .../Completion/BicepCompletionProvider.cs | 18 +++++------ .../Completion/CompletionItemBuilder.cs | 2 +- .../Completion/CompletionItemExtensions.cs | 2 +- .../Language/Completion/CompletionPriority.cs | 2 +- .../Language/Completion/EditorCommands.cs | 2 +- .../IAzureContainerRegistriesProvider.cs | 2 +- .../Completion/ICompletionProvider.cs | 4 +-- .../IModuleReferenceCompletionProvider.cs | 2 +- .../ModuleReferenceCompletionProvider.cs | 5 ++- .../Completion/ResourceTypeSearchKeywords.cs | 4 +-- .../Completion/Snippets/ISnippetsProvider.cs | 2 +- .../Language/Completion/Snippets/Snippet.cs | 4 +-- .../Completion/Snippets/SnippetCache.cs | 2 +- .../Snippets/SnippetCacheBuilder.cs | 4 +-- .../Completion/Snippets/SnippetPlaceholder.cs | 2 +- .../Completion/Snippets/SnippetsProvider.cs | 4 +-- .../Language/Completion/SyntaxMatcher.cs | 2 +- .../SyntaxPatterns/AncestorsCollector.cs | 2 +- .../SyntaxPatterns/CompositeSyntaxPattern.cs | 2 +- .../SyntaxPatterns/LeftSiblingsCollector.cs | 2 +- .../SyntaxPatterns/SyntaxPattern.cs | 2 +- .../SyntaxPatterns/SyntaxTypeComparer.cs | 2 +- .../Definition/BicepDefinitionHandler.cs | 10 +++--- .../Definition/BicepSymbolResolver.cs | 4 +-- .../Language/Definition/ISymbolResolver.cs | 2 +- .../Definition/SymbolResolutionResult.cs | 4 +-- .../BicepDocumentFormattingHandler.cs | 7 ++-- .../BicepDocumentHighlightHandler.cs | 8 ++--- .../BicepExternalSourceDocumentLinkHandler.cs | 12 +++---- .../BicepExternalSourceRequestHandler.cs | 7 ++-- .../DocumentLink/ExternalSourceReference.cs | 2 +- .../BicepDocumentSymbolHandler.cs | 14 ++++---- .../Language/Hover/BicepHoverHandler.cs | 14 ++++---- .../BicepPrepareRenameHandler.cs | 7 ++-- .../References/BicepReferencesHandler.cs | 6 ++-- .../Language/Rename/BicepRenameHandler.cs | 7 ++-- .../BicepSemanticTokensHandler.cs | 6 ++-- .../BicepSignatureHelpHandler.cs | 32 +++++++++---------- .../BicepTextDocumentSyncHandler.cs | 8 ++--- .../BicepDidChangeConfigurationHandler.cs | 3 +- .../BicepDidChangeWatchedFilesHandler.cs | 8 ++--- .../IServiceCollectionExtensions.cs | 18 ++++++----- src/Bicep.LangServer/Server.cs | 31 ++++++++++++++++-- .../Settings/SettingsProvider.cs | 1 + .../Utils/CompilationHelper.cs | 4 +-- src/Bicep.LangServer/Utils/JsonEditor.cs | 2 +- 164 files changed, 390 insertions(+), 376 deletions(-) diff --git a/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs b/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs index 37eb3e293a4..a3ffc0f8131 100644 --- a/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs +++ b/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs @@ -20,7 +20,6 @@ using Bicep.Core.Utils; using Bicep.IO.Abstraction; using Bicep.IO.Utils; -using Bicep.LanguageServer.Handlers; using Bicep.Testing.Assertions; using Bicep.Testing.IO; using Bicep.Testing.Mocks; diff --git a/src/Bicep.Core.UnitTests/BicepTestConstants.cs b/src/Bicep.Core.UnitTests/BicepTestConstants.cs index fd804ffab77..719fd7caaa2 100644 --- a/src/Bicep.Core.UnitTests/BicepTestConstants.cs +++ b/src/Bicep.Core.UnitTests/BicepTestConstants.cs @@ -30,7 +30,7 @@ using Bicep.IO.Abstraction; using Bicep.IO.FileSystem; using Bicep.IO.InMemory; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; diff --git a/src/Bicep.Core.UnitTests/IServiceCollectionExtensions.cs b/src/Bicep.Core.UnitTests/IServiceCollectionExtensions.cs index 471ada6aaf7..2656a7c3b52 100644 --- a/src/Bicep.Core.UnitTests/IServiceCollectionExtensions.cs +++ b/src/Bicep.Core.UnitTests/IServiceCollectionExtensions.cs @@ -27,9 +27,9 @@ using Bicep.Decompiler; using Bicep.IO.Abstraction; using Bicep.IO.FileSystem; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; +using Bicep.LanguageServer.Features.Custom.InsertResource; using Microsoft.Extensions.DependencyInjection; using Moq; using LocalFileSystem = System.IO.Abstractions.FileSystem; diff --git a/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs b/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs index 66868aabc35..79fa64537e6 100644 --- a/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs +++ b/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs @@ -5,7 +5,7 @@ using Bicep.Core.Syntax.Rewriters; using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; diff --git a/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs b/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs index 922d6cafb4d..f065bf15cb1 100644 --- a/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs @@ -16,7 +16,8 @@ using Bicep.Core.Utils; using Bicep.IO.Abstraction; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Language.CodeLens; +using Bicep.LanguageServer.Features.Language.DocumentLink; using Bicep.Testing.Dummies; using Bicep.Testing; using FluentAssertions; diff --git a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs index d2bbc212bf5..00cfba6094e 100644 --- a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs @@ -30,9 +30,8 @@ using Bicep.LangServer.IntegrationTests.Completions; using Bicep.LangServer.IntegrationTests.Helpers; using Bicep.LanguageServer; -using Bicep.LanguageServer.Completions; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Completion; using Bicep.LanguageServer.Settings; using Bicep.LanguageServer.Utils; using FluentAssertions; diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetCompletionTestHelper.cs b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetCompletionTestHelper.cs index f10f0b58387..f294937dfcc 100644 --- a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetCompletionTestHelper.cs +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetCompletionTestHelper.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using System.Text.RegularExpressions; -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using FluentAssertions; namespace Bicep.LangServer.IntegrationTests.Completions diff --git a/src/Bicep.LangServer.IntegrationTests/DeployBicepFileActionTest.cs b/src/Bicep.LangServer.IntegrationTests/DeployBicepFileActionTest.cs index 9197bb4245c..be3f7f267fb 100644 --- a/src/Bicep.LangServer.IntegrationTests/DeployBicepFileActionTest.cs +++ b/src/Bicep.LangServer.IntegrationTests/DeployBicepFileActionTest.cs @@ -12,9 +12,8 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.ResourceStack.Common.Json; @@ -79,7 +78,7 @@ public async Task IncorrectUpdateOption_WithBicepparamFile_ReturnsError() string.Empty, true, string.Empty, - LanguageServer.Deploy.ParametersFileUpdateOption.Create, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.Create, new List(), "https://management.azure.com/", "https://management.core.windows.net/"); @@ -133,7 +132,7 @@ public async Task ProvidingUpdateParameterValues_WithBicepparamFile_ReturnsError string.Empty, true, string.Empty, - LanguageServer.Deploy.ParametersFileUpdateOption.None, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.None, new List{ new("foo", "bar", false, null) }, @@ -188,7 +187,7 @@ public async Task NotProvidingParameterFileName_WithJsonParameterFile_ReturnsErr string.Empty, true, null, //ParametersFileName - LanguageServer.Deploy.ParametersFileUpdateOption.None, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.None, new List(), "https://management.azure.com/", "https://management.core.windows.net/"); @@ -240,7 +239,7 @@ public async Task StartDeploymentAsync_WithInvalidParameterFilePath_ReturnsDeplo string.Empty, true, string.Empty, - LanguageServer.Deploy.ParametersFileUpdateOption.None, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.None, new List(), "https://management.azure.com/", "https://management.core.windows.net/"); @@ -295,7 +294,7 @@ public async Task StartDeploymentAsync_WithInvalidParameterFileContents_ReturnsD string.Empty, true, string.Empty, - LanguageServer.Deploy.ParametersFileUpdateOption.None, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.None, new List(), "https://management.azure.com/", "https://management.core.windows.net/"); @@ -368,7 +367,7 @@ public async Task StartDeploymentAsync_WithNoParameterFile_Succeeds() string.Empty, true, string.Empty, - LanguageServer.Deploy.ParametersFileUpdateOption.None, + LanguageServer.Features.Custom.Deployments.Services.ParametersFileUpdateOption.None, new List(), "https://management.azure.com/", "https://management.core.windows.net/"); diff --git a/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs b/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs index b29d30b0ed1..3ebed954bfe 100644 --- a/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs @@ -17,7 +17,7 @@ using Bicep.LangServer.IntegrationTests.Assertions; using Bicep.LangServer.IntegrationTests.Helpers; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Refactor; +using Bicep.LanguageServer.Features.Language.CodeAction; using Bicep.LanguageServer.Utils; using FluentAssertions; using FluentAssertions.Execution; diff --git a/src/Bicep.LangServer.IntegrationTests/GenerateParamsCommandTests.cs b/src/Bicep.LangServer.IntegrationTests/GenerateParamsCommandTests.cs index 66302384e6b..1204f252385 100644 --- a/src/Bicep.LangServer.IntegrationTests/GenerateParamsCommandTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/GenerateParamsCommandTests.cs @@ -8,7 +8,7 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Parameters; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.ResourceStack.Common.Json; diff --git a/src/Bicep.LangServer.IntegrationTests/Helpers/LanguageServerHelper.cs b/src/Bicep.LangServer.IntegrationTests/Helpers/LanguageServerHelper.cs index 1803cd4b890..16b81a86e38 100644 --- a/src/Bicep.LangServer.IntegrationTests/Helpers/LanguageServerHelper.cs +++ b/src/Bicep.LangServer.IntegrationTests/Helpers/LanguageServerHelper.cs @@ -10,8 +10,8 @@ using Bicep.IO.FileSystem; using Bicep.LangServer.IntegrationTests.Helpers; using Bicep.LanguageServer; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; using Bicep.LanguageServer.Options; -using Bicep.LanguageServer.Registry; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.IntegrationTests/HoverTests.cs b/src/Bicep.LangServer.IntegrationTests/HoverTests.cs index d869ee13dd2..711b273e249 100644 --- a/src/Bicep.LangServer.IntegrationTests/HoverTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/HoverTests.cs @@ -24,7 +24,6 @@ using Bicep.LangServer.IntegrationTests.Assertions; using Bicep.LangServer.IntegrationTests.Extensions; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.CompilationManager; using FluentAssertions; using FluentAssertions.Execution; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs b/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs index 27493bb09d1..a5f5897081a 100644 --- a/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs @@ -7,7 +7,7 @@ using Bicep.Core.UnitTests.Baselines; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Assertions; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.ImportKubernetesManifest; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; diff --git a/src/Bicep.LangServer.IntegrationTests/InsertResourceCommandTests.cs b/src/Bicep.LangServer.IntegrationTests/InsertResourceCommandTests.cs index 499b2df07f1..4a1a9989b4a 100644 --- a/src/Bicep.LangServer.IntegrationTests/InsertResourceCommandTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/InsertResourceCommandTests.cs @@ -17,8 +17,7 @@ using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Assertions; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Custom.InsertResource; using Bicep.LanguageServer.Utils; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.IntegrationTests/LangServerScenarioTests.cs b/src/Bicep.LangServer.IntegrationTests/LangServerScenarioTests.cs index 64eacdf5fbd..3d35f8b5651 100644 --- a/src/Bicep.LangServer.IntegrationTests/LangServerScenarioTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/LangServerScenarioTests.cs @@ -11,7 +11,7 @@ using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Assertions; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.Registry; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.IntegrationTests/Registry/ModuleRestoreSchedulerTests.cs b/src/Bicep.LangServer.IntegrationTests/Registry/ModuleRestoreSchedulerTests.cs index e90b5b00842..51d4582fb14 100644 --- a/src/Bicep.LangServer.IntegrationTests/Registry/ModuleRestoreSchedulerTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/Registry/ModuleRestoreSchedulerTests.cs @@ -18,8 +18,8 @@ using Bicep.Core.Utils; using Bicep.IO.Abstraction; using Bicep.IO.InMemory; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Registry; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.IntegrationTests/TelemetryTests.cs b/src/Bicep.LangServer.IntegrationTests/TelemetryTests.cs index ee49c9eda93..e23725d2e84 100644 --- a/src/Bicep.LangServer.IntegrationTests/TelemetryTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/TelemetryTests.cs @@ -8,7 +8,7 @@ using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Helpers; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; diff --git a/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs b/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs index 834355164d0..28902fea10b 100644 --- a/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs @@ -21,7 +21,7 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Features; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Refactor; +using Bicep.LanguageServer.Features.Language.CodeAction; using FluentAssertions; using FluentAssertions.Execution; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerHelper.cs b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerHelper.cs index 99546d9b7b4..f8c0b5eeb09 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerHelper.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerHelper.cs @@ -11,9 +11,8 @@ using Bicep.Core.UnitTests.Features; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Registry; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; using Microsoft.Extensions.DependencyInjection; using Moq; using OmniSharp.Extensions.LanguageServer.Protocol; diff --git a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs index 491cda61d38..607de8e2032 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs @@ -15,9 +15,9 @@ using Bicep.IO.FileSystem; using Bicep.IO.InMemory; using Bicep.LanguageServer; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/BicepCompilationProviderTests.cs b/src/Bicep.LangServer.UnitTests/BicepCompilationProviderTests.cs index 2e9d42d98d4..afb6cc00fc4 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompilationProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompilationProviderTests.cs @@ -7,7 +7,7 @@ using Bicep.Core.SourceGraph; using Bicep.Core.UnitTests; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Compilation; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs b/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs index a2fa34c5ff7..5e084c39665 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs @@ -15,11 +15,10 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.UnitTests.Completions; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using Bicep.LanguageServer.Settings; -using Bicep.LanguageServer.Snippets; -using Bicep.LanguageServer.Telemetry; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs b/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs index 07942a93e59..591825f98d2 100644 --- a/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs @@ -16,8 +16,8 @@ using Bicep.IO.Abstraction; using Bicep.IO.InMemory; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.DocumentLink; using Bicep.Testing; using Bicep.Testing.Dummies; using FluentAssertions; diff --git a/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs b/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs index a7be139ead3..067c8e26336 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs @@ -3,7 +3,7 @@ using Bicep.Core.UnitTests; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Completions/CompletionItemBuilderTests.cs b/src/Bicep.LangServer.UnitTests/Completions/CompletionItemBuilderTests.cs index 69d2efa6e0a..a500745578f 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/CompletionItemBuilderTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/CompletionItemBuilderTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol.Models; diff --git a/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs b/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs index e795f564791..ae55cd23a3b 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs @@ -20,10 +20,9 @@ using Bicep.Core.UnitTests.Utils; using Bicep.IO.FileSystem; using Bicep.LanguageServer; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Completion; using Bicep.LanguageServer.Settings; -using Bicep.LanguageServer.Telemetry; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs b/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs index 95cd7a88c2f..67ca7cee017 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs @@ -8,8 +8,8 @@ using System.Text; using System.Threading.Tasks; using Bicep.Core.Resources; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol.Models; diff --git a/src/Bicep.LangServer.UnitTests/Configuration/BicepConfigChangeHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Configuration/BicepConfigChangeHandlerTests.cs index 950c4243b72..5c3d803346b 100644 --- a/src/Bicep.LangServer.UnitTests/Configuration/BicepConfigChangeHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Configuration/BicepConfigChangeHandlerTests.cs @@ -12,7 +12,8 @@ using Bicep.Core.UnitTests.Utils; using Bicep.IO.FileSystem; using Bicep.LanguageServer; -using Bicep.LanguageServer.Configuration; +using Bicep.LanguageServer.BicepConfig; +using Bicep.LanguageServer.Compilation; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/Configuration/ConfigurationHelperTests.cs b/src/Bicep.LangServer.UnitTests/Configuration/ConfigurationHelperTests.cs index ee6da88f2d4..5fbc71ea4ca 100644 --- a/src/Bicep.LangServer.UnitTests/Configuration/ConfigurationHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Configuration/ConfigurationHelperTests.cs @@ -5,7 +5,6 @@ using Bicep.Core.Configuration; using Bicep.Core.UnitTests.Utils; using Bicep.IO.FileSystem; -using Bicep.LanguageServer.Configuration; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol; diff --git a/src/Bicep.LangServer.UnitTests/Configuration/JsonEditorTests.cs b/src/Bicep.LangServer.UnitTests/Configuration/JsonEditorTests.cs index 7a31dc222be..193028a88a1 100644 --- a/src/Bicep.LangServer.UnitTests/Configuration/JsonEditorTests.cs +++ b/src/Bicep.LangServer.UnitTests/Configuration/JsonEditorTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Configuration; +using Bicep.LanguageServer.Utils; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs index b6527040b37..4e9db67c902 100644 --- a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs @@ -11,7 +11,7 @@ using Bicep.Core.Json; using Bicep.Core.UnitTests.Mock; using Bicep.LanguageServer; -using Bicep.LanguageServer.Deploy; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentParametersHelperTests.cs b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentParametersHelperTests.cs index 3f687b1659a..bf0aa91d5ad 100644 --- a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentParametersHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentParametersHelperTests.cs @@ -4,8 +4,8 @@ using System.Diagnostics.CodeAnalysis; using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs index 0e69ca6cd9c..647da70e9a9 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs @@ -8,8 +8,8 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Build; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepCodeActionHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepCodeActionHandlerTests.cs index 98e8fe80ba2..39b4aa55b5f 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepCodeActionHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepCodeActionHandlerTests.cs @@ -9,9 +9,10 @@ using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.IntegrationTests.Helpers; using Bicep.LanguageServer; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Language.CodeAction; using Bicep.LanguageServer.Options; -using Bicep.LanguageServer.Providers; using Bicep.LanguageServer.Utils; using FluentAssertions; using Grpc.Net.Client.Balancer; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs index b0a1c078977..63c9b1b9a22 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs @@ -7,8 +7,8 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.UnitTests.Mocks; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Decompile; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs index 835caf92315..1ed54fb778e 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs @@ -7,12 +7,12 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.UnitTests.Mocks; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Decompile; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.JsonRpc; -using static Bicep.LanguageServer.Handlers.BicepDecompileForPasteCommandHandler; +using static Bicep.LanguageServer.Features.Custom.Decompile.BicepDecompileForPasteCommandHandler; namespace Bicep.LangServer.UnitTests.Handlers { diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs index 4a0e248db1f..de9ccd8fa22 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs @@ -7,12 +7,12 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.UnitTests.Mocks; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Decompile; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.JsonRpc; -using static Bicep.LanguageServer.Handlers.BicepDecompileForPasteCommandHandler; +using static Bicep.LanguageServer.Features.Custom.Decompile.BicepDecompileForPasteCommandHandler; namespace Bicep.LangServer.UnitTests.Handlers { diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileParamsCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileParamsCommandHandlerTests.cs index 1760841ef03..639aff0109c 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileParamsCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileParamsCommandHandlerTests.cs @@ -7,7 +7,7 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Decompile; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs index 9616a250d2c..fb2c9d7a254 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs @@ -9,8 +9,8 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs index bc9d25c96b0..d1417e0a837 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs @@ -9,9 +9,9 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentStartCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentStartCommandHandlerTests.cs index 72ed76c7b71..8f0a7638b8c 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentStartCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentStartCommandHandlerTests.cs @@ -8,10 +8,9 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -101,7 +100,6 @@ param bar int param foo = 'something' param bar = '1' "; - var expectedError = @"Error BCP033: Expected a value of type ""int"" but the provided value is of type ""'1'"""; string bicepFilePath = FileHelper.SaveResultFile(TestContext, "main.bicep", bicepFileContents); diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepEditLinterRuleCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepEditLinterRuleCommandHandlerTests.cs index 15d58de29e7..3ea3637ed4b 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepEditLinterRuleCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepEditLinterRuleCommandHandlerTests.cs @@ -8,8 +8,8 @@ using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; using Bicep.LangServer.UnitTests.Mocks; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Linter; +using Bicep.LanguageServer.Features.Custom.Telemetry; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepExternalSourceDocumentLinkHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepExternalSourceDocumentLinkHandlerTests.cs index ac8d6ec062d..bdc13733734 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepExternalSourceDocumentLinkHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepExternalSourceDocumentLinkHandlerTests.cs @@ -23,8 +23,8 @@ using Bicep.LangServer.IntegrationTests; using Bicep.LangServer.IntegrationTests.Assertions; using Bicep.LangServer.UnitTests.Mocks; -using Bicep.LanguageServer.Handlers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.DocumentLink; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs index a9457e49127..e3ce6610c57 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs @@ -7,8 +7,8 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Mock; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs index f89495253ae..763946b2a53 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs @@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; using Bicep.Core.UnitTests.Assertions; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Configuration; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepSemanticTokensHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepSemanticTokensHandlerTests.cs index b4ba7e0e952..a9fbedb2324 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepSemanticTokensHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepSemanticTokensHandlerTests.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.Highlighting; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Language.SemanticTokens; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepTextDocumentSyncHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepTextDocumentSyncHandlerTests.cs index 5756f2427a4..6e74876c746 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepTextDocumentSyncHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepTextDocumentSyncHandlerTests.cs @@ -8,10 +8,10 @@ using Bicep.Core.UnitTests; using Bicep.IO.FileSystem; using Bicep.LangServer.IntegrationTests.Helpers; -using Bicep.LanguageServer.Configuration; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.BicepConfig; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.TextDocumentSync; using Bicep.LanguageServer.Options; -using Bicep.LanguageServer.Telemetry; using Bicep.LanguageServer.Utils; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/src/Bicep.LangServer.UnitTests/Helpers/CompilationHelperTests.cs b/src/Bicep.LangServer.UnitTests/Helpers/CompilationHelperTests.cs index e383e887745..72bbbc1a405 100644 --- a/src/Bicep.LangServer.UnitTests/Helpers/CompilationHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Helpers/CompilationHelperTests.cs @@ -6,6 +6,7 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Utils; using Bicep.LanguageServer; +using Bicep.LanguageServer.Compilation; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol; diff --git a/src/Bicep.LangServer.UnitTests/Mocks/LanguageServerMock.cs b/src/Bicep.LangServer.UnitTests/Mocks/LanguageServerMock.cs index a63f98bcaf8..248cc662ae4 100644 --- a/src/Bicep.LangServer.UnitTests/Mocks/LanguageServerMock.cs +++ b/src/Bicep.LangServer.UnitTests/Mocks/LanguageServerMock.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.UnitTests.Mock; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.ClientCapabilities; using Moq; using OmniSharp.Extensions.LanguageServer.Protocol.Server; diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs index 885ff210004..bd64668fe60 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs @@ -5,7 +5,7 @@ using Bicep.Core.UnitTests; using Bicep.Core.UnitTests.Assertions; using Bicep.Core.UnitTests.Baselines; -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs index ba5c1080d0a..7681ad14f8b 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs index 3ec91b95067..282518b0863 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs @@ -12,8 +12,8 @@ using Bicep.Core.UnitTests.Features; using Bicep.Core.UnitTests.Utils; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Bicep.LangServer.UnitTests/Telemetry/TelemetryHelperTests.cs b/src/Bicep.LangServer.UnitTests/Telemetry/TelemetryHelperTests.cs index 7549630a82d..4eaf7f1e046 100644 --- a/src/Bicep.LangServer.UnitTests/Telemetry/TelemetryHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Telemetry/TelemetryHelperTests.cs @@ -7,7 +7,7 @@ using Bicep.Core.Configuration; using Bicep.Core.UnitTests; using Bicep.Core.UnitTests.Utils; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol; diff --git a/src/Bicep.LangServer/BicepConfig/BicepConfigLifecycleManager.cs b/src/Bicep.LangServer/BicepConfig/BicepConfigLifecycleManager.cs index ddd5abeb763..ae07e475bda 100644 --- a/src/Bicep.LangServer/BicepConfig/BicepConfigLifecycleManager.cs +++ b/src/Bicep.LangServer/BicepConfig/BicepConfigLifecycleManager.cs @@ -4,11 +4,11 @@ using Bicep.Core.Analyzers.Linter; using Bicep.Core.Configuration; using Bicep.Core.SourceGraph; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Telemetry; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Configuration +namespace Bicep.LanguageServer.BicepConfig { public class BicepConfigLifecycleManager : IBicepConfigLifecycleManager { diff --git a/src/Bicep.LangServer/BicepConfig/IBicepConfigLifecycleManager.cs b/src/Bicep.LangServer/BicepConfig/IBicepConfigLifecycleManager.cs index 24d93f92ab5..ee457bf3e91 100644 --- a/src/Bicep.LangServer/BicepConfig/IBicepConfigLifecycleManager.cs +++ b/src/Bicep.LangServer/BicepConfig/IBicepConfigLifecycleManager.cs @@ -3,7 +3,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Configuration +namespace Bicep.LanguageServer.BicepConfig { public interface IBicepConfigLifecycleManager { diff --git a/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs b/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs index 58122777be6..64e5ff0739b 100644 --- a/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs +++ b/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs @@ -4,7 +4,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Server; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.ClientCapabilities { public class ClientCapabilitiesProvider : IClientCapabilitiesProvider { @@ -17,14 +17,14 @@ public ClientCapabilitiesProvider(ILanguageServerFacade server) public bool DoesClientSupportWorkspaceFolders() { - return server.Workspace.ClientSettings.Capabilities is ClientCapabilities clientCapabilitites && + return server.Workspace.ClientSettings.Capabilities is global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilitites && clientCapabilitites.Workspace is WorkspaceClientCapabilities workspaceClientCapabilities && workspaceClientCapabilities.WorkspaceFolders.IsSupported; } public bool DoesClientSupportShowDocumentRequest() { - return server.ClientSettings.Capabilities is ClientCapabilities clientCapabilities && + return server.ClientSettings.Capabilities is global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities && clientCapabilities.Window is WindowClientCapabilities windowClientCapabilities && windowClientCapabilities.ShowDocument.IsSupported; } diff --git a/src/Bicep.LangServer/ClientCapabilities/IClientCapabilitiesProvider.cs b/src/Bicep.LangServer/ClientCapabilities/IClientCapabilitiesProvider.cs index 5e105476035..9a143f6f1e0 100644 --- a/src/Bicep.LangServer/ClientCapabilities/IClientCapabilitiesProvider.cs +++ b/src/Bicep.LangServer/ClientCapabilities/IClientCapabilitiesProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.ClientCapabilities { public interface IClientCapabilitiesProvider { diff --git a/src/Bicep.LangServer/Compilation/BicepCompilationManager.cs b/src/Bicep.LangServer/Compilation/BicepCompilationManager.cs index f51aee39aca..eda433e1516 100644 --- a/src/Bicep.LangServer/Compilation/BicepCompilationManager.cs +++ b/src/Bicep.LangServer/Compilation/BicepCompilationManager.cs @@ -13,11 +13,9 @@ using Bicep.Core.SourceGraph; using Bicep.Core.Syntax; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Registry; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using OmniSharp.Extensions.LanguageServer.Protocol; @@ -27,7 +25,7 @@ using static Bicep.Core.Diagnostics.DisabledDiagnosticsCache; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer +namespace Bicep.LanguageServer.Compilation { public class BicepCompilationManager : ICompilationManager { diff --git a/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs b/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs index e19dd8ee0a8..9cb7e4fc9ee 100644 --- a/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs +++ b/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs @@ -10,11 +10,10 @@ using Bicep.Core.SourceGraph; using Bicep.Core.Utils; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; using Microsoft.Extensions.DependencyInjection; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Compilation { /// /// Creates compilation contexts. @@ -77,7 +76,7 @@ private CompilationContext CreateContext( SourceFileGrouping syntaxTreeGrouping, ImmutableDictionary modelLookup) { - var compilation = new Compilation( + var compilation = new global::Bicep.Core.Semantics.Compilation( environment, namespaceProvider, syntaxTreeGrouping, diff --git a/src/Bicep.LangServer/Compilation/CompilationContext.cs b/src/Bicep.LangServer/Compilation/CompilationContext.cs index efc55fba3d4..ea13b9751a6 100644 --- a/src/Bicep.LangServer/Compilation/CompilationContext.cs +++ b/src/Bicep.LangServer/Compilation/CompilationContext.cs @@ -4,7 +4,7 @@ using Bicep.Core.Semantics; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.CompilationManager +namespace Bicep.LanguageServer.Compilation { /// /// Represents a compilation context that successfully produced a compilation @@ -12,14 +12,14 @@ namespace Bicep.LanguageServer.CompilationManager /// public class CompilationContext : CompilationContextBase { - public CompilationContext(Compilation compilation) + public CompilationContext(global::Bicep.Core.Semantics.Compilation compilation) // on a successful compilation, we can reuse the entry point file kind : base(compilation.SourceFileGrouping.EntryPoint.FileKind) { this.Compilation = compilation; } - public Compilation Compilation { get; } + public global::Bicep.Core.Semantics.Compilation Compilation { get; } public ProgramSyntax ProgramSyntax => Compilation.SourceFileGrouping.EntryPoint.ProgramSyntax; diff --git a/src/Bicep.LangServer/Compilation/CompilationContextBase.cs b/src/Bicep.LangServer/Compilation/CompilationContextBase.cs index 049666a1d63..23525961fa1 100644 --- a/src/Bicep.LangServer/Compilation/CompilationContextBase.cs +++ b/src/Bicep.LangServer/Compilation/CompilationContextBase.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.SourceGraph; -namespace Bicep.LanguageServer.CompilationManager +namespace Bicep.LanguageServer.Compilation { /// /// Base class for both successful and unsafe compilation contexts. diff --git a/src/Bicep.LangServer/Compilation/ICompilationManager.cs b/src/Bicep.LangServer/Compilation/ICompilationManager.cs index 2741367faf1..29074c5f5a9 100644 --- a/src/Bicep.LangServer/Compilation/ICompilationManager.cs +++ b/src/Bicep.LangServer/Compilation/ICompilationManager.cs @@ -4,7 +4,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.CompilationManager +namespace Bicep.LanguageServer.Compilation { public interface ICompilationManager { diff --git a/src/Bicep.LangServer/Compilation/ICompilationProvider.cs b/src/Bicep.LangServer/Compilation/ICompilationProvider.cs index 722da173058..890b667b653 100644 --- a/src/Bicep.LangServer/Compilation/ICompilationProvider.cs +++ b/src/Bicep.LangServer/Compilation/ICompilationProvider.cs @@ -3,10 +3,9 @@ using System.Collections.Immutable; using Bicep.Core.Semantics; using Bicep.Core.SourceGraph; -using Bicep.LanguageServer.CompilationManager; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Compilation { public interface ICompilationProvider { diff --git a/src/Bicep.LangServer/Compilation/UnsafeCompilationContext.cs b/src/Bicep.LangServer/Compilation/UnsafeCompilationContext.cs index 8cf2d9f030c..5be4dad3293 100644 --- a/src/Bicep.LangServer/Compilation/UnsafeCompilationContext.cs +++ b/src/Bicep.LangServer/Compilation/UnsafeCompilationContext.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.SourceGraph; -namespace Bicep.LanguageServer.CompilationManager +namespace Bicep.LanguageServer.Compilation { /// /// Represents a compilation context that failed to produce a compilation diff --git a/src/Bicep.LangServer/Features/Custom/Build/BicepBuildCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Build/BicepBuildCommandHandler.cs index 32ed950d944..feb2ce06932 100644 --- a/src/Bicep.LangServer/Features/Custom/Build/BicepBuildCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Build/BicepBuildCommandHandler.cs @@ -7,7 +7,7 @@ using Bicep.Core.Diagnostics; using Bicep.Core.Emit; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using Microsoft.WindowsAzure.ResourceStack.Common.Json; @@ -16,7 +16,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Build { // This handler is used to generate compiled .json file for given a bicep file path. // It returns build succeeded/failed message, which can be displayed appropriately in IDE output window diff --git a/src/Bicep.LangServer/Features/Custom/Build/BicepBuildParamsCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Build/BicepBuildParamsCommandHandler.cs index d0361ab786c..a17249f15ab 100644 --- a/src/Bicep.LangServer/Features/Custom/Build/BicepBuildParamsCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Build/BicepBuildParamsCommandHandler.cs @@ -8,7 +8,7 @@ using Bicep.Core.Extensions; using Bicep.Core.Json; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using Microsoft.WindowsAzure.ResourceStack.Common.Json; @@ -17,7 +17,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Build { // This handler is used to build compiled parameters.json file for given a bicep file path. // It returns build-params succeeded/failed message, which can be displayed appropriately in IDE output window diff --git a/src/Bicep.LangServer/Features/Custom/Configuration/BicepCreateConfigFileHandler.cs b/src/Bicep.LangServer/Features/Custom/Configuration/BicepCreateConfigFileHandler.cs index 764fb9ea4cd..c0bd31f44f2 100644 --- a/src/Bicep.LangServer/Features/Custom/Configuration/BicepCreateConfigFileHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Configuration/BicepCreateConfigFileHandler.cs @@ -2,14 +2,15 @@ // Licensed under the MIT License. using Bicep.Core.Configuration; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Features.Custom.Linter; using MediatR; using Microsoft.Extensions.Logging; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Configuration { public class BicepCreateConfigParams : IRequest { diff --git a/src/Bicep.LangServer/Features/Custom/Configuration/BicepGetRecommendedConfigLocationHandler.cs b/src/Bicep.LangServer/Features/Custom/Configuration/BicepGetRecommendedConfigLocationHandler.cs index c64a209d89b..b061905d90f 100644 --- a/src/Bicep.LangServer/Features/Custom/Configuration/BicepGetRecommendedConfigLocationHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Configuration/BicepGetRecommendedConfigLocationHandler.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. using System.Runtime.InteropServices; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.ClientCapabilities; using MediatR; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Configuration { [Method("bicep/getRecommendedConfigLocation", Direction.ClientToServer)] public record BicepGetRecommendedConfigLocationParams : IRequest diff --git a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileCommandHandler.cs index 8bf7c4a7cc5..c2644579fbe 100644 --- a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileCommandHandler.cs @@ -9,14 +9,14 @@ using Bicep.Decompiler; using Bicep.Decompiler.ArmHelpers; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Decompile { public record DecompiledFile( // absolute path to overwrite - could be outside input file's folder/subfolders (e.g. ".." in module path) diff --git a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileForPasteCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileForPasteCommandHandler.cs index ec59f4e0524..3c8c6687eb8 100644 --- a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileForPasteCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileForPasteCommandHandler.cs @@ -13,14 +13,14 @@ using Bicep.Core.Syntax; using Bicep.Decompiler; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Decompile { public record BicepDecompileForPasteCommandParams( string bicepContent, diff --git a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileParamsCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileParamsCommandHandler.cs index c345da6624b..99dd7e6a210 100644 --- a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileParamsCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileParamsCommandHandler.cs @@ -10,7 +10,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Decompile { public record BicepDecompileParamsCommandParams( DocumentUri jsonUri, diff --git a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileSaveCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileSaveCommandHandler.cs index 28a0529844e..1b717b12a32 100644 --- a/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileSaveCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Decompile/BicepDecompileSaveCommandHandler.cs @@ -4,15 +4,15 @@ using System.Diagnostics; using System.Text; using Bicep.Decompiler; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Features.Custom.Telemetry; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; using Path = System.IO.Path; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Decompile { public record BicepDecompileSaveCommandParams( string decompileId, diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentParametersHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentParametersHandler.cs index 13857c343a0..85949750361 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentParametersHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentParametersHandler.cs @@ -5,14 +5,14 @@ using Bicep.Core.Semantics; using Bicep.Core.Syntax; using Bicep.Core.TypeSystem; -using Bicep.LanguageServer.Deploy; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Deployments { public record BicepDeploymentParametersResponse(List deploymentParameters, string parametersFileName, string? errorMessage); diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs index 3776027bb3a..c30b6c69bf0 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs @@ -7,8 +7,8 @@ using Bicep.Core.Emit; using Bicep.Core.Semantics; using Bicep.Core.TypeSystem; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Deploy; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; using Bicep.LanguageServer.Utils; using MediatR; using OmniSharp.Extensions.JsonRpc; @@ -16,7 +16,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Deployments { public record BicepDeploymentScopeParams(TextDocumentIdentifier TextDocument) : ITextDocumentIdentifierParams, IRequest; @@ -74,7 +74,7 @@ public override async Task Handle(BicepDeploymentS _ => resourceScope.ToString() }; - private string GetCompiledFile(Compilation compilation, DocumentUri documentUri) + private string GetCompiledFile(global::Bicep.Core.Semantics.Compilation compilation, DocumentUri documentUri) { if (compilation.HasErrors()) { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentStartCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentStartCommandHandler.cs index ef0f31285b1..c58845cc6ce 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentStartCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentStartCommandHandler.cs @@ -7,10 +7,9 @@ using Bicep.Core.Extensions; using Bicep.Core.Json; using Bicep.Core.Tracing; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.LanguageServer.Utils; using MediatR; using Newtonsoft.Json.Linq; @@ -18,7 +17,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Deployments { public record BicepUpdatedDeploymentParameter(string name, string value, bool isSecure, ParameterType? parameterType); diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentWaitForCompletionCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentWaitForCompletionCommandHandler.cs index 06585ec80d9..42f1c967a5b 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentWaitForCompletionCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentWaitForCompletionCommandHandler.cs @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Deploy; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; +using Bicep.LanguageServer.Features.Custom.Telemetry; using MediatR; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Deployments { public record BicepDeploymentWaitForCompletionParams(string deployId, string documentPath) : IRequest; diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/GetDeploymentDataHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/GetDeploymentDataHandler.cs index 8a023217617..e706649f4e0 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/GetDeploymentDataHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/GetDeploymentDataHandler.cs @@ -4,13 +4,14 @@ using Bicep.Core.Semantics; using Bicep.Core.SourceGraph; using Bicep.Core.TypeSystem; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Language.DocumentSymbol; using MediatR; using Microsoft.Extensions.Logging; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Deployments { [Method("bicep/getDeploymentData", Direction.ClientToServer)] public record GetDeploymentDataRequest(TextDocumentIdentifier TextDocument) diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/CredentialFromTokenAndTimeStamp.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/CredentialFromTokenAndTimeStamp.cs index 3041e0ecce4..60ff0f35e3e 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/CredentialFromTokenAndTimeStamp.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/CredentialFromTokenAndTimeStamp.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class CredentialFromTokenAndTimeStamp : TokenCredential { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentCollectionProvider.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentCollectionProvider.cs index a31f1a668a4..9bed9498c16 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentCollectionProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentCollectionProvider.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.Resources; using Bicep.Core; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentCollectionProvider : IDeploymentCollectionProvider { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs index 998990cb9d9..b6fd3677f74 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs @@ -5,20 +5,20 @@ using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentFileCompilationCache : IDeploymentFileCompilationCache { - private readonly ConcurrentDictionary compilationCache = new(); + private readonly ConcurrentDictionary compilationCache = new(); - public void CacheCompilation(DocumentUri documentUri, Compilation compilation) + public void CacheCompilation(DocumentUri documentUri, global::Bicep.Core.Semantics.Compilation compilation) { compilationCache.TryAdd(documentUri, compilation); } - public Compilation? FindAndRemoveCompilation(DocumentUri documentUri) + public global::Bicep.Core.Semantics.Compilation? FindAndRemoveCompilation(DocumentUri documentUri) { - if (compilationCache.TryRemove(documentUri, out Compilation? compilation) && compilation is not null) + if (compilationCache.TryRemove(documentUri, out global::Bicep.Core.Semantics.Compilation? compilation) && compilation is not null) { return compilation; } diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentHelper.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentHelper.cs index ef5516684c0..f252d7363c2 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentHelper.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentHelper.cs @@ -8,9 +8,9 @@ using Azure.ResourceManager.Resources; using Azure.ResourceManager.Resources.Models; using Bicep.Core; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Deployments; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentHelper : IDeploymentHelper diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentOperationsCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentOperationsCache.cs index 792d6c6d50b..b83e42a5bd1 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentOperationsCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentOperationsCache.cs @@ -5,7 +5,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Resources; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentOperationsCache : IDeploymentOperationsCache { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentParametersHelper.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentParametersHelper.cs index 39af1e99934..21071aa4969 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentParametersHelper.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentParametersHelper.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Configuration; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Utils; using Newtonsoft.Json.Linq; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentParametersHelper { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentCollectionProvider.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentCollectionProvider.cs index a62f7e38084..2f5315319a7 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentCollectionProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentCollectionProvider.cs @@ -5,7 +5,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Resources; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public interface IDeploymentCollectionProvider { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs index c1e46de65e1..905a39c0bf6 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs @@ -4,12 +4,12 @@ using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public interface IDeploymentFileCompilationCache { - public void CacheCompilation(DocumentUri documentUri, Compilation compilation); + public void CacheCompilation(DocumentUri documentUri, global::Bicep.Core.Semantics.Compilation compilation); - public Compilation? FindAndRemoveCompilation(DocumentUri documentUri); + public global::Bicep.Core.Semantics.Compilation? FindAndRemoveCompilation(DocumentUri documentUri); } } diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentHelper.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentHelper.cs index 80c6a27c8ab..45af2e54b7e 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentHelper.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentHelper.cs @@ -3,9 +3,9 @@ using System.Text.Json; using Azure.ResourceManager; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Custom.Deployments; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public interface IDeploymentHelper { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentOperationsCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentOperationsCache.cs index f43b647df8d..1080be83350 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentOperationsCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentOperationsCache.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Resources; -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public interface IDeploymentOperationsCache { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParameterType.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParameterType.cs index 6f29936de7b..ef3e9c4511f 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParameterType.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParameterType.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public enum ParameterType { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParametersFileUpdateOption.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParametersFileUpdateOption.cs index 60199c10aec..3540acfe61a 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParametersFileUpdateOption.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/ParametersFileUpdateOption.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Deploy +namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public enum ParametersFileUpdateOption { diff --git a/src/Bicep.LangServer/Features/Custom/ImportKubernetesManifest/ImportKubernetesManifestHandler.cs b/src/Bicep.LangServer/Features/Custom/ImportKubernetesManifest/ImportKubernetesManifestHandler.cs index 3564b093f13..67e70f03e98 100644 --- a/src/Bicep.LangServer/Features/Custom/ImportKubernetesManifest/ImportKubernetesManifestHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/ImportKubernetesManifest/ImportKubernetesManifestHandler.cs @@ -11,14 +11,14 @@ using Bicep.Core.Semantics.Namespaces; using Bicep.Core.Syntax; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using MediatR; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using SharpYaml; using SharpYaml.Model; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.ImportKubernetesManifest { [Method("bicep/importKubernetesManifest", Direction.ClientToServer)] public record ImportKubernetesManifestRequest(string ManifestFilePath) diff --git a/src/Bicep.LangServer/Features/Custom/InsertResource/AzResourceProvider.cs b/src/Bicep.LangServer/Features/Custom/InsertResource/AzResourceProvider.cs index 9328235863b..5b13b639c21 100644 --- a/src/Bicep.LangServer/Features/Custom/InsertResource/AzResourceProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/InsertResource/AzResourceProvider.cs @@ -7,7 +7,7 @@ using Bicep.Core.Configuration; using Bicep.Core.Tracing; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Custom.InsertResource { public class AzResourceProvider : IAzResourceProvider { diff --git a/src/Bicep.LangServer/Features/Custom/InsertResource/IAzResourceProvider.cs b/src/Bicep.LangServer/Features/Custom/InsertResource/IAzResourceProvider.cs index 7e5d6f05fa5..2669cad774e 100644 --- a/src/Bicep.LangServer/Features/Custom/InsertResource/IAzResourceProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/InsertResource/IAzResourceProvider.cs @@ -3,7 +3,7 @@ using System.Text.Json; using Bicep.Core.Configuration; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Custom.InsertResource { public interface IAzResourceProvider { diff --git a/src/Bicep.LangServer/Features/Custom/InsertResource/InsertResourceHandler.cs b/src/Bicep.LangServer/Features/Custom/InsertResource/InsertResourceHandler.cs index a1b3555df80..e4a3a62dc9e 100644 --- a/src/Bicep.LangServer/Features/Custom/InsertResource/InsertResourceHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/InsertResource/InsertResourceHandler.cs @@ -21,10 +21,9 @@ using Bicep.Core.Syntax; using Bicep.Core.Text; using Bicep.IO.InMemory; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.LanguageServer.Utils; using MediatR; using OmniSharp.Extensions.JsonRpc; @@ -33,7 +32,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.InsertResource { [Method("textDocument/insertResource", Direction.ClientToServer)] public record InsertResourceParams : TextDocumentPositionParams, IRequest diff --git a/src/Bicep.LangServer/Features/Custom/Linter/BicepEditLinterRuleCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Linter/BicepEditLinterRuleCommandHandler.cs index edeca1b2bc4..a388caa7188 100644 --- a/src/Bicep.LangServer/Features/Custom/Linter/BicepEditLinterRuleCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Linter/BicepEditLinterRuleCommandHandler.cs @@ -3,9 +3,10 @@ using Bicep.Core; using Bicep.Core.Configuration; -using Bicep.LanguageServer.Configuration; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Features.Custom.Configuration; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Utils; using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -16,7 +17,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Linter { /// /// Handles the internal command for code actions to edit a particular linter rule in the bicepconfig.json file diff --git a/src/Bicep.LangServer/Features/Custom/LocalDeploy/LocalDeployHandler.cs b/src/Bicep.LangServer/Features/Custom/LocalDeploy/LocalDeployHandler.cs index 28231b45f8a..1b7be4e70e1 100644 --- a/src/Bicep.LangServer/Features/Custom/LocalDeploy/LocalDeployHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/LocalDeploy/LocalDeployHandler.cs @@ -11,7 +11,7 @@ using Bicep.Core.Semantics; using Bicep.Core.TypeSystem.Types; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.Local.Deploy; using Bicep.Local.Deploy.Extensibility; using MediatR; @@ -22,7 +22,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; -namespace Bicep.LanguageServer.Handlers; +namespace Bicep.LanguageServer.Features.Custom.LocalDeploy; [Method("bicep/localDeploy", Direction.ClientToServer)] public record LocalDeployRequest(TextDocumentIdentifier TextDocument) diff --git a/src/Bicep.LangServer/Features/Custom/ModuleRestore/BicepForceModulesRestoreCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/ModuleRestore/BicepForceModulesRestoreCommandHandler.cs index 24524f3fa0f..07fa3652149 100644 --- a/src/Bicep.LangServer/Features/Custom/ModuleRestore/BicepForceModulesRestoreCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/ModuleRestore/BicepForceModulesRestoreCommandHandler.cs @@ -10,13 +10,13 @@ using Bicep.Core.Syntax; using Bicep.Core.Utils; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.ModuleRestore { // This handler is used to force the modules restore for given a bicep file. // It returns Restore (force) succeeded/failed message, which can be displayed appropriately in IDE output window diff --git a/src/Bicep.LangServer/Features/Custom/ModuleRestore/IModuleRestoreScheduler.cs b/src/Bicep.LangServer/Features/Custom/ModuleRestore/IModuleRestoreScheduler.cs index f8c4acdc508..04c59ccdac4 100644 --- a/src/Bicep.LangServer/Features/Custom/ModuleRestore/IModuleRestoreScheduler.cs +++ b/src/Bicep.LangServer/Features/Custom/ModuleRestore/IModuleRestoreScheduler.cs @@ -4,10 +4,10 @@ using Bicep.Core.Navigation; using Bicep.Core.Registry; using Bicep.Core.SourceGraph; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Registry +namespace Bicep.LanguageServer.Features.Custom.ModuleRestore { public interface IModuleRestoreScheduler { diff --git a/src/Bicep.LangServer/Features/Custom/ModuleRestore/ModuleRestoreScheduler.cs b/src/Bicep.LangServer/Features/Custom/ModuleRestore/ModuleRestoreScheduler.cs index ea36d38ab77..3e3fcbc4c29 100644 --- a/src/Bicep.LangServer/Features/Custom/ModuleRestore/ModuleRestoreScheduler.cs +++ b/src/Bicep.LangServer/Features/Custom/ModuleRestore/ModuleRestoreScheduler.cs @@ -5,10 +5,10 @@ using System.Diagnostics; using Bicep.Core.Registry; using Bicep.Core.SourceGraph; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using OmniSharp.Extensions.LanguageServer.Protocol; -namespace Bicep.LanguageServer.Registry +namespace Bicep.LanguageServer.Features.Custom.ModuleRestore { public sealed class ModuleRestoreScheduler : IModuleRestoreScheduler, IAsyncDisposable { diff --git a/src/Bicep.LangServer/Features/Custom/Parameters/BicepGenerateParamsCommandHandler.cs b/src/Bicep.LangServer/Features/Custom/Parameters/BicepGenerateParamsCommandHandler.cs index f1a0ba1d765..f74d703dfcc 100644 --- a/src/Bicep.LangServer/Features/Custom/Parameters/BicepGenerateParamsCommandHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Parameters/BicepGenerateParamsCommandHandler.cs @@ -6,7 +6,7 @@ using Bicep.Core.Emit; using Bicep.Core.Emit.Options; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using Microsoft.WindowsAzure.ResourceStack.Common.Json; @@ -15,7 +15,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Parameters { public record BicepGenerateParamsCommandParams( string BicepFilePath, diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryEvent.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryEvent.cs index 0d6eeb8c194..3f810f2fa46 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryEvent.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryEvent.cs @@ -5,7 +5,7 @@ using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Telemetry +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public static class EventResult { diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryHandler.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryHandler.cs index 85242f441ae..ae7e9401f89 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/BicepTelemetryHandler.cs @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Telemetry; using MediatR; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Telemetry { // This handler is used to send a request from the client to the server(E.g. command sent as part // of completion item of top level declaration snippet) which in turn triggers a request from server to client, diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/ITelemetryProvider.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/ITelemetryProvider.cs index 0cdca0407ee..6c8e005765f 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/ITelemetryProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/ITelemetryProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Telemetry +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public interface ITelemetryProvider { diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryAndErrorHandlingHelper.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryAndErrorHandlingHelper.cs index 83bd555b81e..8675470f6fd 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryAndErrorHandlingHelper.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryAndErrorHandlingHelper.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.Telemetry; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public class TelemetryAndErrorHandlingHelper { diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryConstants.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryConstants.cs index af4b3c8e3d3..f088ca89a90 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryConstants.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryConstants.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Telemetry +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public static class TelemetryConstants { diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryHelper.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryHelper.cs index 987f99ba399..cc534fa3435 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryHelper.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryHelper.cs @@ -6,7 +6,7 @@ using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Telemetry +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public class TelemetryHelper { diff --git a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryProvider.cs b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryProvider.cs index 7e35d62e624..fb3bda32b34 100644 --- a/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryProvider.cs +++ b/src/Bicep.LangServer/Features/Custom/Telemetry/TelemetryProvider.cs @@ -4,7 +4,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; -namespace Bicep.LanguageServer.Telemetry +namespace Bicep.LanguageServer.Features.Custom.Telemetry { public class TelemetryProvider : ITelemetryProvider { diff --git a/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphBuilder.cs b/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphBuilder.cs index ab96e8045f0..be795d59d8a 100644 --- a/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphBuilder.cs +++ b/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphBuilder.cs @@ -10,7 +10,7 @@ using Bicep.Core.Syntax; using Bicep.Core.Text; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; using Bicep.LanguageServer.Features.Custom.Visualization.Models; diff --git a/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphUpdateHandler.cs b/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphUpdateHandler.cs index 59e266f2631..8864eda8404 100644 --- a/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphUpdateHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Visualization/VisualGraphUpdateHandler.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; using Bicep.LanguageServer.Features.Custom.Visualization.Models; using MediatR; diff --git a/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs b/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs index 302b8428eb2..5ea123d69ae 100644 --- a/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs @@ -13,13 +13,11 @@ using Bicep.Core.Syntax; using Bicep.Core.Text; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Model; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Refactor; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Completion; using Bicep.LanguageServer.Utils; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol; @@ -28,7 +26,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.CodeAction { // Provides code actions/fixes for a range in a Bicep document public class BicepCodeActionHandler : CodeActionHandlerBase @@ -187,7 +185,7 @@ private static IEnumerable GetDecoratorCodeFixProvider args: JArray.FromObject(new List { telemetryEvent }) ); - return new CodeAction + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction { Title = string.Format(LangServerResources.DisableDiagnosticForThisLine, diagnosticCode.String), Edit = new WorkspaceEdit @@ -203,7 +201,7 @@ private static IEnumerable GetDecoratorCodeFixProvider private static CommandOrCodeAction CreateEditLinterRuleAction(DocumentUri documentUri, string ruleName, IOUri? configFileIdentifier) { - return new CodeAction + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction { Title = String.Format(LangServerResources.EditLinterRuleActionTitle, ruleName), Command = TelemetryHelper.CreateCommand @@ -215,7 +213,7 @@ private static CommandOrCodeAction CreateEditLinterRuleAction(DocumentUri docume }; } - public override Task Handle(CodeAction request, CancellationToken cancellationToken) + public override Task Handle(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction request, CancellationToken cancellationToken) { // we are currently precomputing our quickfixes, so there's no need to resolve them after they are chosen // this shouldn't be called because registration options disabled the resolve functionality @@ -232,7 +230,7 @@ private static CommandOrCodeAction CreateCodeActionFromFix(DocumentUri uri, Comp _ => CodeActionKind.Empty, }; - return new CodeAction + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction { Kind = codeActionKind, Title = fix.Title, @@ -252,7 +250,7 @@ private static CommandOrCodeAction CreateCodeActionFromFix(DocumentUri uri, Comp }; } - protected override CodeActionRegistrationOptions CreateRegistrationOptions(CodeActionCapability capability, ClientCapabilities clientCapabilities) => new() + protected override CodeActionRegistrationOptions CreateRegistrationOptions(CodeActionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), CodeActionKinds = new Container(CodeActionKind.QuickFix), diff --git a/src/Bicep.LangServer/Features/Language/CodeAction/CodeFixWithCommand.cs b/src/Bicep.LangServer/Features/Language/CodeAction/CodeFixWithCommand.cs index 9a5ddfb6d7c..2a910fdd900 100644 --- a/src/Bicep.LangServer/Features/Language/CodeAction/CodeFixWithCommand.cs +++ b/src/Bicep.LangServer/Features/Language/CodeAction/CodeFixWithCommand.cs @@ -6,10 +6,10 @@ using System.Security.Policy; using Bicep.Core.CodeAction; using Bicep.IO.Abstraction; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Model; +namespace Bicep.LanguageServer.Features.Language.CodeAction; public class CodeFixWithCommand : CodeFix { diff --git a/src/Bicep.LangServer/Features/Language/CodeAction/ExpressionAndTypeExtractor.cs b/src/Bicep.LangServer/Features/Language/CodeAction/ExpressionAndTypeExtractor.cs index 6d02a384797..9eb97732047 100644 --- a/src/Bicep.LangServer/Features/Language/CodeAction/ExpressionAndTypeExtractor.cs +++ b/src/Bicep.LangServer/Features/Language/CodeAction/ExpressionAndTypeExtractor.cs @@ -19,19 +19,17 @@ using Bicep.Core.Text; using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Model; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Completion; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -using static Bicep.LanguageServer.Completions.BicepCompletionContext; -using static Bicep.LanguageServer.Refactor.TypeStringifier; -using static Bicep.LanguageServer.Telemetry.BicepTelemetryEvent; +using static Bicep.LanguageServer.Features.Custom.Telemetry.BicepTelemetryEvent; +using static Bicep.LanguageServer.Features.Language.CodeAction.TypeStringifier; +using static Bicep.LanguageServer.Features.Language.Completion.BicepCompletionContext; using static Google.Protobuf.Reflection.ExtensionRangeOptions.Types; using Type = System.Type; -namespace Bicep.LanguageServer.Refactor; +namespace Bicep.LanguageServer.Features.Language.CodeAction; // Provides code actions/fixes for extracting variables, parameters and types in a Bicep document public class ExpressionAndTypeExtractor : ICodeFixProvider diff --git a/src/Bicep.LangServer/Features/Language/CodeAction/TypeStringifier.cs b/src/Bicep.LangServer/Features/Language/CodeAction/TypeStringifier.cs index f76ee48f78f..9a0c585a745 100644 --- a/src/Bicep.LangServer/Features/Language/CodeAction/TypeStringifier.cs +++ b/src/Bicep.LangServer/Features/Language/CodeAction/TypeStringifier.cs @@ -9,7 +9,7 @@ using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -namespace Bicep.LanguageServer.Refactor; +namespace Bicep.LanguageServer.Features.Language.CodeAction; public static class TypeStringifier { diff --git a/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs b/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs index cc872bbc99c..cf1b7800def 100644 --- a/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs +++ b/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs @@ -9,7 +9,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.CodeLens { // Provides code lenses for a range in a Bicep document public class BicepCodeLensHandler : CodeLensHandlerBase @@ -34,12 +34,12 @@ public BicepCodeLensHandler(IModuleDispatcher moduleDispatcher, ISourceFileFacto return Task.FromResult(new CodeLensContainer(lenses)); } - public override Task Handle(CodeLens request, CancellationToken cancellationToken) + public override Task Handle(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens request, CancellationToken cancellationToken) { throw new NotImplementedException(); } - protected override CodeLensRegistrationOptions CreateRegistrationOptions(CodeLensCapability capability, ClientCapabilities clientCapabilities) => new() + protected override CodeLensRegistrationOptions CreateRegistrationOptions(CodeLensCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = new( documentSelectorFactory.CreateForAllSupportedLangIds() diff --git a/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs b/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs index 7de076fbb8e..3ea2a708c7b 100644 --- a/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs +++ b/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs @@ -8,18 +8,19 @@ using Bicep.Core.SourceLink; using Bicep.Core.Utils; using Bicep.LanguageServer.Extensions; +using Bicep.LanguageServer.Features.Language.DocumentLink; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.CodeLens { // Provides code lenses when displaying source from an external bicep module public static class ExternalSourceCodeLensProvider { private static readonly Range DocumentStart = new(new Position(0, 0), new Position(0, 0)); - public static IEnumerable GetCodeLenses(IModuleDispatcher moduleDispatcher, ISourceFileFactory sourceFileFactory, CodeLensParams request, CancellationToken cancellationToken) + public static IEnumerable GetCodeLenses(IModuleDispatcher moduleDispatcher, ISourceFileFactory sourceFileFactory, CodeLensParams request, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -103,15 +104,15 @@ public static IEnumerable GetCodeLenses(IModuleDispatcher moduleDispat } } - CodeLens CreateErrorLens(string message) + global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens CreateErrorLens(string message) { return CreateCodeLens(DocumentStart, message); } } - private static CodeLens CreateCodeLens(Range range, string title, string? commandName = null, params string[] commandArguments) + private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens CreateCodeLens(Range range, string title, string? commandName = null, params string[] commandArguments) { - return new CodeLens + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens { Range = range, Command = new Command @@ -125,7 +126,7 @@ private static CodeLens CreateCodeLens(Range range, string title, string? comman } // Allows tests to filter to just code lenses that were created by this provider - public static bool IsExternalSourceCodeLens(this CodeLens codeLens) + public static bool IsExternalSourceCodeLens(this global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens codeLens) { return codeLens.Data?.Value() == nameof(ExternalSourceCodeLensProvider); } diff --git a/src/Bicep.LangServer/Features/Language/Completion/AzureContainerRegistriesProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/AzureContainerRegistriesProvider.cs index dde3c304f7f..e9d8678283d 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/AzureContainerRegistriesProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/AzureContainerRegistriesProvider.cs @@ -12,7 +12,7 @@ using Bicep.Core.Tracing; using Newtonsoft.Json.Linq; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Language.Completion { /// /// This provider fetches all the Azure Container Registries (ACR) names that the user has access to via Azure diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs index d103871cb95..b5d1b663118 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs @@ -12,13 +12,13 @@ using Bicep.Core.SourceGraph; using Bicep.Core.Syntax; using Bicep.Core.Text; -using Bicep.LanguageServer.Completions.SyntaxPatterns; using Bicep.LanguageServer.Extensions; +using Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns; using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public class BicepCompletionContext { @@ -141,7 +141,7 @@ private BicepCompletionContext( public IFeatureProvider Features { get; } - public static BicepCompletionContext Create(Compilation compilation, int offset) + public static BicepCompletionContext Create(global::Bicep.Core.Semantics.Compilation compilation, int offset) { var model = compilation.GetEntrypointSemanticModel(); var bicepFile = model.SourceFile; diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContextKind.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContextKind.cs index dfcf1b67028..11d4b17e912 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContextKind.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContextKind.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { // TODO: investigating using https://learn.microsoft.com/en-us/dotnet/api/system.collections.bitarray?redirectedfrom=MSDN&view=net-6.0. [Flags] diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs index 75a101eb5cb..9c838da4c11 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs @@ -2,8 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.Features; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using Microsoft.Extensions.Logging; using OmniSharp.Extensions.LanguageServer.Protocol; @@ -11,7 +10,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.Completion { public class BicepCompletionHandler : CompletionHandlerBase { @@ -60,7 +59,7 @@ public override Task Handle(CompletionItem request, Cancellation return this.completionProvider.Resolve(request, cancellationToken); } - protected override CompletionRegistrationOptions CreateRegistrationOptions(CompletionCapability capability, ClientCapabilities clientCapabilities) => new() + protected override CompletionRegistrationOptions CreateRegistrationOptions(CompletionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), AllCommitCharacters = new Container(), diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs index 40fc078b115..089e053bb1d 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs @@ -23,15 +23,15 @@ using Bicep.Core.TypeSystem.Types; using Bicep.IO.Abstraction; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Snippets; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; using Bicep.LanguageServer.Utils; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; using SymbolKind = Bicep.Core.Semantics.SymbolKind; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public partial class BicepCompletionProvider : ICompletionProvider { @@ -50,7 +50,7 @@ public BicepCompletionProvider(ISnippetsProvider snippetsProvider, IModuleRefere this.moduleReferenceCompletionProvider = moduleReferenceCompletionProvider; } - public async Task> GetFilteredCompletions(Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken) + public async Task> GetFilteredCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken) { var model = compilation.GetEntrypointSemanticModel(); @@ -1219,7 +1219,7 @@ IEnumerable GetAccessible(IEnumerable symbols, T }; } - private static IEnumerable GetMemberAccessCompletions(Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetMemberAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.MemberAccess) || context.PropertyAccess == null) { @@ -1252,7 +1252,7 @@ private static IEnumerable GetMemberAccessCompletions(Compilatio .Select(m => CreateSymbolCompletion(m, context.ReplacementRange, model))); } - private static IEnumerable GetTypeMemberAccessCompletions(Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetTypeMemberAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.TypeMemberAccess) || context.TypePropertyAccess is null) { @@ -1286,7 +1286,7 @@ private static IEnumerable GetTypeMemberAccessCompletions(Compil return completions; } - private static IEnumerable GetTypeArrayIndexCompletions(Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetTypeArrayIndexCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.TypeArrayIndex)) { @@ -1339,7 +1339,7 @@ private static IEnumerable GetTypeArrayIndexCompletions(Compilat return []; } - private static IEnumerable GetResourceAccessCompletions(Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetResourceAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.ResourceAccess) || context.ResourceAccess == null) { @@ -1361,7 +1361,7 @@ private static IEnumerable GetResourceAccessCompletions(Compilat .Select(entry => CreateSymbolCompletion(entry.symbol!, context.ReplacementRange, model)); } - private static IEnumerable GetArrayIndexCompletions(Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetArrayIndexCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.ArrayIndex) || context.ArrayAccess == null) { diff --git a/src/Bicep.LangServer/Features/Language/Completion/CompletionItemBuilder.cs b/src/Bicep.LangServer/Features/Language/Completion/CompletionItemBuilder.cs index 7c90f828559..33f0edeef45 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/CompletionItemBuilder.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/CompletionItemBuilder.cs @@ -5,7 +5,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public class CompletionItemBuilder { diff --git a/src/Bicep.LangServer/Features/Language/Completion/CompletionItemExtensions.cs b/src/Bicep.LangServer/Features/Language/Completion/CompletionItemExtensions.cs index f93e4932810..c7bd746a6ec 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/CompletionItemExtensions.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/CompletionItemExtensions.cs @@ -5,7 +5,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public static class CompletionItemExtensions { diff --git a/src/Bicep.LangServer/Features/Language/Completion/CompletionPriority.cs b/src/Bicep.LangServer/Features/Language/Completion/CompletionPriority.cs index 1788301a45e..b3455201119 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/CompletionPriority.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/CompletionPriority.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { /// /// Represents the priority of the completion. The higher the property (lower value), diff --git a/src/Bicep.LangServer/Features/Language/Completion/EditorCommands.cs b/src/Bicep.LangServer/Features/Language/Completion/EditorCommands.cs index fe310e5db93..69cab0ef3dc 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/EditorCommands.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/EditorCommands.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { /// /// Constants for editor commands to be used with completions. diff --git a/src/Bicep.LangServer/Features/Language/Completion/IAzureContainerRegistriesProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/IAzureContainerRegistriesProvider.cs index d6853420fa0..a6f012f49e3 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/IAzureContainerRegistriesProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/IAzureContainerRegistriesProvider.cs @@ -3,7 +3,7 @@ using Bicep.Core.Configuration; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Language.Completion { public interface IAzureContainerRegistriesProvider { diff --git a/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs index 8f7d8669959..c65114e529a 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs @@ -4,11 +4,11 @@ using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public interface ICompletionProvider { - Task> GetFilteredCompletions(Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken); + Task> GetFilteredCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken); Task Resolve(CompletionItem completionItem, CancellationToken cancellationToken) { diff --git a/src/Bicep.LangServer/Features/Language/Completion/IModuleReferenceCompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/IModuleReferenceCompletionProvider.cs index e5429025079..8ceb125cbdf 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/IModuleReferenceCompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/IModuleReferenceCompletionProvider.cs @@ -4,7 +4,7 @@ using Bicep.Core.SourceGraph; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public interface IModuleReferenceCompletionProvider { diff --git a/src/Bicep.LangServer/Features/Language/Completion/ModuleReferenceCompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/ModuleReferenceCompletionProvider.cs index e697f70ab3b..8d18f7062cc 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/ModuleReferenceCompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/ModuleReferenceCompletionProvider.cs @@ -16,9 +16,8 @@ using Bicep.Core.Registry.Oci; using Bicep.Core.SourceGraph; using Bicep.Core.Syntax; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.LanguageServer.Settings; -using Bicep.LanguageServer.Telemetry; using Bicep.LanguageServer.Utils; using Microsoft.VisualBasic; using Microsoft.Win32; @@ -27,7 +26,7 @@ using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { /// /// Provides completions for OCI (public or private) module references, e.g. br/public:modulePath:version diff --git a/src/Bicep.LangServer/Features/Language/Completion/ResourceTypeSearchKeywords.cs b/src/Bicep.LangServer/Features/Language/Completion/ResourceTypeSearchKeywords.cs index b039df787d0..81b65dacd8a 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/ResourceTypeSearchKeywords.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/ResourceTypeSearchKeywords.cs @@ -10,9 +10,9 @@ using System.Threading.Tasks; using Bicep.Core.Parsing; using Bicep.Core.Resources; -using Bicep.LanguageServer.Snippets; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public partial class ResourceTypeSearchKeywords { diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/ISnippetsProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/ISnippetsProvider.cs index a14d6b7f773..5ee8145f22f 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/ISnippetsProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/ISnippetsProvider.cs @@ -6,7 +6,7 @@ using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -namespace Bicep.LanguageServer.Snippets +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets { public interface ISnippetsProvider { diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/Snippet.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/Snippet.cs index 51475471d02..421ec8533b0 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/Snippet.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/Snippet.cs @@ -6,9 +6,9 @@ using System.Text.RegularExpressions; using Bicep.Core.Parsing; using Bicep.Core.Text; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; -namespace Bicep.LanguageServer.Snippets +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets { public sealed class Snippet { diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCache.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCache.cs index 5f6366ff85d..58fd3fb6cdc 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCache.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCache.cs @@ -6,7 +6,7 @@ using System.Text.Json; using Bicep.Core.Resources; -namespace Bicep.LanguageServer.Snippets; +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets; public record SnippetCache( ImmutableDictionary ResourceTypeReferenceInfoMap, diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCacheBuilder.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCacheBuilder.cs index 09186ba4fe1..44f47e99be7 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCacheBuilder.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetCacheBuilder.cs @@ -17,9 +17,9 @@ using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; using Bicep.IO.InMemory; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; -namespace Bicep.LanguageServer.Snippets; +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets; public class SnippetCacheBuilder { diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetPlaceholder.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetPlaceholder.cs index aa50e94b0d6..e3609801120 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetPlaceholder.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetPlaceholder.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.Text; -namespace Bicep.LanguageServer.Snippets +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets { public class SnippetPlaceholder { diff --git a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetsProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetsProvider.cs index a06131b5d7a..dfc1e5f30c3 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetsProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/Snippets/SnippetsProvider.cs @@ -15,9 +15,9 @@ using Bicep.Core.Syntax; using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Features.Language.Completion; -namespace Bicep.LanguageServer.Snippets; +namespace Bicep.LanguageServer.Features.Language.Completion.Snippets; public class SnippetsProvider : ISnippetsProvider { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxMatcher.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxMatcher.cs index 6acab1c1fae..520b77d983b 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxMatcher.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxMatcher.cs @@ -8,7 +8,7 @@ using Bicep.Core.Syntax; using Bicep.Core.Text; -namespace Bicep.LanguageServer.Completions +namespace Bicep.LanguageServer.Features.Language.Completion { public static class SyntaxMatcher { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/AncestorsCollector.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/AncestorsCollector.cs index 74d767bf2c7..383517fb900 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/AncestorsCollector.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/AncestorsCollector.cs @@ -4,7 +4,7 @@ using Bicep.Core.Parsing; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.Completions.SyntaxPatterns +namespace Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns { public class AncestorsCollector : CstVisitor { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/CompositeSyntaxPattern.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/CompositeSyntaxPattern.cs index 9368d77bdb4..170bcbad5c3 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/CompositeSyntaxPattern.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/CompositeSyntaxPattern.cs @@ -4,7 +4,7 @@ using Bicep.Core.Parsing; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.Completions.SyntaxPatterns +namespace Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns { public class CompositeSyntaxPattern { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/LeftSiblingsCollector.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/LeftSiblingsCollector.cs index 0bc72c17772..4d77da27800 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/LeftSiblingsCollector.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/LeftSiblingsCollector.cs @@ -4,7 +4,7 @@ using Bicep.Core.Extensions; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.Completions.SyntaxPatterns +namespace Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns { public class LeftSiblingsCollector : CstVisitor { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxPattern.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxPattern.cs index 8ee9ef0ace8..5d882247fab 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxPattern.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxPattern.cs @@ -6,7 +6,7 @@ using Bicep.Core.Parsing; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.Completions.SyntaxPatterns +namespace Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns { public class SyntaxPattern { diff --git a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxTypeComparer.cs b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxTypeComparer.cs index 15fd5be658b..6b816500929 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxTypeComparer.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/SyntaxPatterns/SyntaxTypeComparer.cs @@ -5,7 +5,7 @@ using Bicep.Core.Parsing; using Bicep.Core.Syntax; -namespace Bicep.LanguageServer.Completions.SyntaxPatterns +namespace Bicep.LanguageServer.Features.Language.Completion.SyntaxPatterns { public class SyntaxTypeComparer : IEqualityComparer { diff --git a/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs b/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs index e37be512fc1..77b8b94ecc4 100644 --- a/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs @@ -22,10 +22,10 @@ using Bicep.Core.Utils; using Bicep.IO.Abstraction; using Bicep.IO.InMemory; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.DocumentLink; using Bicep.LanguageServer.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -36,7 +36,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Server; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.Definition { public class BicepDefinitionHandler( ISymbolResolver symbolResolver, @@ -87,7 +87,7 @@ ISourceFileFactory sourceFileFactory }; } - protected override DefinitionRegistrationOptions CreateRegistrationOptions(DefinitionCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DefinitionRegistrationOptions CreateRegistrationOptions(DefinitionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/Definition/BicepSymbolResolver.cs b/src/Bicep.LangServer/Features/Language/Definition/BicepSymbolResolver.cs index 32cf151e2a9..931e43d7753 100644 --- a/src/Bicep.LangServer/Features/Language/Definition/BicepSymbolResolver.cs +++ b/src/Bicep.LangServer/Features/Language/Definition/BicepSymbolResolver.cs @@ -4,13 +4,13 @@ using Bicep.Core.Parsing; using Bicep.Core.Semantics; using Bicep.Core.Syntax; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using Microsoft.Extensions.Logging; using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Language.Definition { public class BicepSymbolResolver : ISymbolResolver { diff --git a/src/Bicep.LangServer/Features/Language/Definition/ISymbolResolver.cs b/src/Bicep.LangServer/Features/Language/Definition/ISymbolResolver.cs index c01fe0d8f21..2111d84158d 100644 --- a/src/Bicep.LangServer/Features/Language/Definition/ISymbolResolver.cs +++ b/src/Bicep.LangServer/Features/Language/Definition/ISymbolResolver.cs @@ -3,7 +3,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Language.Definition { public interface ISymbolResolver { diff --git a/src/Bicep.LangServer/Features/Language/Definition/SymbolResolutionResult.cs b/src/Bicep.LangServer/Features/Language/Definition/SymbolResolutionResult.cs index 0898ba8ea77..5a4b20a121a 100644 --- a/src/Bicep.LangServer/Features/Language/Definition/SymbolResolutionResult.cs +++ b/src/Bicep.LangServer/Features/Language/Definition/SymbolResolutionResult.cs @@ -2,9 +2,9 @@ // Licensed under the MIT License. using Bicep.Core.Semantics; using Bicep.Core.Syntax; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; -namespace Bicep.LanguageServer.Providers +namespace Bicep.LanguageServer.Features.Language.Definition { public class SymbolResolutionResult { diff --git a/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs index 11211c9b985..f369732be04 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs @@ -2,8 +2,9 @@ // Licensed under the MIT License. using Bicep.Core.PrettyPrint; using Bicep.Core.PrettyPrintV2; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; +using Bicep.LanguageServer.Features.Language.DocumentSymbol; using Bicep.LanguageServer.Utils; using Microsoft.Extensions.Logging; using OmniSharp.Extensions.LanguageServer.Protocol; @@ -11,7 +12,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentFormatting { public class BicepDocumentFormattingHandler( ILogger logger, @@ -63,7 +64,7 @@ public class BicepDocumentFormattingHandler( })); } - protected override DocumentFormattingRegistrationOptions CreateRegistrationOptions(DocumentFormattingCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DocumentFormattingRegistrationOptions CreateRegistrationOptions(DocumentFormattingCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs index ae622a219a7..d9f70f9914d 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. using Bicep.Core.Navigation; using Bicep.Core.Syntax; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Definition; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentHighlight { public class BicepDocumentHighlightHandler(ISymbolResolver symbolResolver, DocumentSelectorFactory documentSelectorFactory) : DocumentHighlightHandlerBase { @@ -22,7 +22,7 @@ public class BicepDocumentHighlightHandler(ISymbolResolver symbolResolver, Docum var highlights = result.Context.Compilation.GetEntrypointSemanticModel() .FindReferences(result.Symbol) - .Select(referenceSyntax => new DocumentHighlight + .Select(referenceSyntax => new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentHighlight { Range = PositionHelper.GetNameRange(result.Context.LineStarts, referenceSyntax), Kind = referenceSyntax switch @@ -36,7 +36,7 @@ public class BicepDocumentHighlightHandler(ISymbolResolver symbolResolver, Docum return Task.FromResult(new DocumentHighlightContainer(highlights)); } - protected override DocumentHighlightRegistrationOptions CreateRegistrationOptions(DocumentHighlightCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DocumentHighlightRegistrationOptions CreateRegistrationOptions(DocumentHighlightCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs index 285c44a04a8..027d1ea7b20 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs @@ -9,10 +9,8 @@ using Bicep.Core.Registry.Oci; using Bicep.Core.SourceGraph; using Bicep.Core.SourceLink; -using Bicep.LanguageServer.CompilationManager; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using OmniSharp.Extensions.JsonRpc.Server.Messages; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; @@ -21,9 +19,9 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Server; using OmniSharp.Extensions.LanguageServer.Protocol.Window; using static Bicep.Core.Diagnostics.DiagnosticBuilder; -using static Bicep.LanguageServer.Telemetry.BicepTelemetryEvent; +using static Bicep.LanguageServer.Features.Custom.Telemetry.BicepTelemetryEvent; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentLink { #nullable disable // The generated code is not yet nullable-aware, this disables #nullable for the generated code to fix that @@ -63,7 +61,7 @@ protected override async Task> Hand return await ResolveDocumentLink(request, ModuleDispatcher, sourceFileFactory, Server, TelemetryProvider); } - protected override DocumentLinkRegistrationOptions CreateRegistrationOptions(DocumentLinkCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DocumentLinkRegistrationOptions CreateRegistrationOptions(DocumentLinkCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = TextDocumentSelector.ForScheme(LangServerConstants.ExternalSourceFileScheme), ResolveProvider = true, @@ -120,7 +118,7 @@ public static IEnumerable> GetDocum } else { - yield return new DocumentLink() + yield return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentLink() { // This is a link to a file that we don't have source for, so we'll just display the main.json file Range = nestedLink.Range.ToRange(), diff --git a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceRequestHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceRequestHandler.cs index e05794cc7ca..7d8bf39060e 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceRequestHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceRequestHandler.cs @@ -11,12 +11,13 @@ using Bicep.Core.SourceLink; using Bicep.IO.Abstraction; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Telemetry; +using Bicep.LanguageServer.Features.Custom.Telemetry; +using Bicep.LanguageServer.Features.Language.Definition; using MediatR; using OmniSharp.Extensions.JsonRpc; -using static Bicep.LanguageServer.Telemetry.BicepTelemetryEvent; +using static Bicep.LanguageServer.Features.Custom.Telemetry.BicepTelemetryEvent; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentLink { [Method(BicepExternalSourceRequestHandler.BicepExternalSourceLspMethodName, Direction.ClientToServer)] public record BicepExternalSourceParams( diff --git a/src/Bicep.LangServer/Features/Language/DocumentLink/ExternalSourceReference.cs b/src/Bicep.LangServer/Features/Language/DocumentLink/ExternalSourceReference.cs index 5dfac8ebebf..ffd9753b833 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentLink/ExternalSourceReference.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentLink/ExternalSourceReference.cs @@ -13,7 +13,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using static Bicep.Core.Diagnostics.DiagnosticBuilder; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentLink { /// /// Represents a URI to request displaying a source file from an external module diff --git a/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs index a8f396bbc1e..65219f32d5f 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs @@ -4,7 +4,7 @@ using System.Collections.Immutable; using Bicep.Core.Semantics; using Bicep.Core.Syntax; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; using Bicep.LanguageServer.Utils; using Microsoft.Extensions.Logging; @@ -13,7 +13,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using SymbolKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.SymbolKind; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.DocumentSymbol { public class BicepDocumentSymbolHandler : DocumentSymbolHandlerBase { @@ -51,9 +51,9 @@ private IEnumerable GetSymbols(CompilationCon .Select(symbol => new SymbolInformationOrDocumentSymbol(CreateDocumentSymbol(model, symbol, context.LineStarts))); } - private DocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol symbol, ImmutableArray lineStarts) + private global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol symbol, ImmutableArray lineStarts) { - var children = Enumerable.Empty(); + var children = Enumerable.Empty(); if (symbol is ResourceSymbol resourceSymbol && resourceSymbol.DeclaringResource.TryGetBody() is ObjectSyntax body) { @@ -63,12 +63,12 @@ private DocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol .Select(s => CreateDocumentSymbol(model, s!, lineStarts)); } - return new DocumentSymbol + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbol { Name = symbol.Name, Kind = SelectSymbolKind(symbol), Detail = FormatDetail(symbol), - Children = new Container(children), + Children = new Container(children), Range = symbol.DeclaringSyntax.ToRange(lineStarts), // use the name node span with fallback to entire declaration span SelectionRange = symbol.NameSource.ToRange(lineStarts) @@ -107,7 +107,7 @@ private DocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol _ => string.Empty, }; - protected override DocumentSymbolRegistrationOptions CreateRegistrationOptions(DocumentSymbolCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DocumentSymbolRegistrationOptions CreateRegistrationOptions(DocumentSymbolCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs b/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs index b8f520f8ca8..95a379bb076 100644 --- a/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs @@ -12,15 +12,15 @@ using Bicep.Core.Syntax; using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Definition; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.Hover { public class BicepHoverHandler : HoverHandlerBase { @@ -44,7 +44,7 @@ public BicepHoverHandler( this.documentSelectorFactory = documentSelectorFactory; } - public override async Task Handle(HoverParams request, CancellationToken cancellationToken) + public override async Task Handle(HoverParams request, CancellationToken cancellationToken) { // ResolveSymbol returns null over a resource type string; fall back to show the resource hover there. var result = this.symbolResolver.ResolveSymbol(request.TextDocument.Uri, request.Position) @@ -60,7 +60,7 @@ public BicepHoverHandler( return null; } - return new Hover + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover { Contents = markdown, Range = PositionHelper.GetNameRange(result.Context.LineStarts, result.Origin) @@ -373,7 +373,7 @@ private static string GetFunctionOverloadMarkdown(FunctionOverload overload) private static MarkedStringsOrMarkupContent AsMarkdown(IEnumerable markdown) => new(markdown.Select(md => new MarkedString(md))); - protected override HoverRegistrationOptions CreateRegistrationOptions(HoverCapability capability, ClientCapabilities clientCapabilities) => new() + protected override HoverRegistrationOptions CreateRegistrationOptions(HoverCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs b/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs index 3bcd5312f57..c64f53f618f 100644 --- a/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs +++ b/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs @@ -1,13 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Definition; +using Bicep.LanguageServer.Features.Language.Rename; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.PrepareRename { public class BicepPrepareRenameHandler : PrepareRenameHandlerBase { @@ -37,7 +38,7 @@ public BicepPrepareRenameHandler(ISymbolResolver symbolResolver, DocumentSelecto }); } - protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, ClientCapabilities clientCapabilities) => new() + protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { // textDocument/prepareRename is advertised through renameProvider.prepareProvider. // BicepRenameHandler owns that advertisement; registering a second document selector here diff --git a/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs b/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs index 2b1993619f6..482267b9d53 100644 --- a/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs +++ b/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. using Bicep.Core.Navigation; using Bicep.Core.Semantics; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Definition; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.References { public class BicepReferencesHandler(ISymbolResolver symbolResolver, DocumentSelectorFactory documentSelectorFactory) : ReferencesHandlerBase { @@ -39,7 +39,7 @@ public class BicepReferencesHandler(ISymbolResolver symbolResolver, DocumentSele return new(references); } - protected override ReferenceRegistrationOptions CreateRegistrationOptions(ReferenceCapability capability, ClientCapabilities clientCapabilities) => new() + protected override ReferenceRegistrationOptions CreateRegistrationOptions(ReferenceCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs b/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs index 45b5c1d32b9..3ccfd2e7ef3 100644 --- a/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs @@ -5,7 +5,8 @@ using Bicep.Core.Semantics; using Bicep.Core.Syntax; using Bicep.LanguageServer.Extensions; -using Bicep.LanguageServer.Providers; +using Bicep.LanguageServer.Features.Language.Definition; +using Bicep.LanguageServer.Features.Language.PrepareRename; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.JsonRpc.Server; @@ -14,7 +15,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.Rename { public class BicepRenameHandler : RenameHandlerBase { @@ -95,7 +96,7 @@ internal static SymbolResolutionResult ResolveRenameableSymbol(ISymbolResolver s } } - protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, ClientCapabilities clientCapabilities) => new() + protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = this.documentSelectorFactory.CreateForBicepAndParams(), PrepareProvider = true diff --git a/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs b/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs index 5ffc05e154c..5469b6dd32e 100644 --- a/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs +++ b/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using Bicep.Core.Highlighting; using Bicep.Core.Semantics; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Extensions; using Bicep.LanguageServer.Utils; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; @@ -11,7 +11,7 @@ using BicepTokenType = Bicep.Core.Highlighting.SemanticTokenType; using LspTokenType = OmniSharp.Extensions.LanguageServer.Protocol.Models.SemanticTokenType; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.SemanticTokens { public class BicepSemanticTokensHandler(ICompilationManager compilationManager, DocumentSelectorFactory documentSelectorFactory) : SemanticTokensHandlerBase { @@ -81,7 +81,7 @@ public static void BuildSemanticTokens(SemanticTokensBuilder builder, SemanticMo _ => throw new NotImplementedException($"No mapping for token type {tokenType}"), }; - protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(SemanticTokensCapability capability, ClientCapabilities clientCapabilities) => new() + protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(SemanticTokensCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { // the semantic tokens handler requests don't get routed like other handlers // it seems we can only have one and it must be shared between all the language IDs we support diff --git a/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs b/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs index ee78cc25f77..ebca09e122d 100644 --- a/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs +++ b/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs @@ -9,15 +9,15 @@ using Bicep.Core.Text; using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Types; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Language.Completion; using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.SignatureHelp { public class BicepSignatureHelpHandler(ICompilationManager compilationManager, DocumentSelectorFactory documentSelectorFactory) : SignatureHelpHandlerBase { @@ -26,7 +26,7 @@ public class BicepSignatureHelpHandler(ICompilationManager compilationManager, D private const string TypeArgumentsStart = "<"; private const string TypeArgumentsEnd = ">"; - public override Task Handle(SignatureHelpParams request, CancellationToken cancellationToken) + public override Task Handle(SignatureHelpParams request, CancellationToken cancellationToken) { // local function @@ -48,7 +48,7 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation }; } - private static Task NoHelp() => Task.FromResult(null); + private static Task NoHelp() => Task.FromResult(null); private static SyntaxBase? GetActiveSyntaxInNeedOfSignatureHelp(ProgramSyntax syntax, int offset) { @@ -80,7 +80,7 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation return null; } - private static Task Handle(CompilationContext context, + private static Task Handle(CompilationContext context, FunctionCallSyntaxBase functionCall, int offset, SignatureHelpParams request) @@ -106,10 +106,10 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation var signatureHelp = CreateSignatureHelp(functionCall.Arguments, normalizedArgumentTypes, functionSymbol, offset, includeReturnType); signatureHelp = TryReuseActiveSignature(request.Context, signatureHelp); - return Task.FromResult(signatureHelp); + return Task.FromResult(signatureHelp); } - private static SignatureHelp TryReuseActiveSignature(SignatureHelpContext? context, SignatureHelp signatureHelp) + private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp TryReuseActiveSignature(SignatureHelpContext? context, global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp signatureHelp) { if (context?.ActiveSignatureHelp == null || string.Equals(context.TriggerCharacter, FunctionArgumentStart, StringComparison.Ordinal) || @@ -133,7 +133,7 @@ private static SignatureHelp TryReuseActiveSignature(SignatureHelpContext? conte return signatureHelp; } - private static bool CheckIfSignatureHelpSimilar(SignatureHelp active, SignatureHelp @new) + private static bool CheckIfSignatureHelpSimilar(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp active, global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp @new) { // local function static string GetFunctionName(SignatureInformation info) @@ -165,7 +165,7 @@ private static List NormalizeArgumentTypes(ImmutableArray arguments, List normalizedArgumentTypes, IFunctionSymbol symbol, int offset, bool includeReturnType) + private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp CreateSignatureHelp(ImmutableArray arguments, List normalizedArgumentTypes, IFunctionSymbol symbol, int offset, bool includeReturnType) { // exclude overloads where the specified arguments have exceeded the maximum // allow count mismatches because the user may not have started typing the arguments yet @@ -181,7 +181,7 @@ private static SignatureHelp CreateSignatureHelp(ImmutableArray tuple.result == FunctionMatchResult.PotentialMatch); } - return new SignatureHelp + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp { Signatures = new Container(matchingOverloads.Select(tuple => CreateSignature(tuple.overload, arguments, includeReturnType))), ActiveSignature = activeSignatureIndex < 0 ? (int?)null : activeSignatureIndex, @@ -277,7 +277,7 @@ private static void AppendParameter(StringBuilder typeSignature, List Handle(CompilationContext context, + private static Task Handle(CompilationContext context, ParameterizedTypeInstantiationSyntaxBase typeInstantiation, int offset) { @@ -295,7 +295,7 @@ private static void AppendParameter(StringBuilder typeSignature, List null, }; - return Task.FromResult(CreateSignatureHelp(parameterizable, documentation, typeInstantiation.Arguments, offset)); + return Task.FromResult(CreateSignatureHelp(parameterizable, documentation, typeInstantiation.Arguments, offset)); } private static TypeSymbol? GetSymbolType(Symbol? symbol) => symbol switch @@ -306,9 +306,9 @@ private static void AppendParameter(StringBuilder typeSignature, List null, }; - private static SignatureHelp CreateSignatureHelp(TypeTemplate typeTemplate, string? documentation, ImmutableArray arguments, int offset) + private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp CreateSignatureHelp(TypeTemplate typeTemplate, string? documentation, ImmutableArray arguments, int offset) { - return new SignatureHelp + return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp { Signatures = new Container(CreateSignature(typeTemplate, documentation)), ActiveSignature = 0, @@ -362,7 +362,7 @@ private static SignatureInformation CreateSignature(TypeTemplate typeTemplate, s }; } - protected override SignatureHelpRegistrationOptions CreateRegistrationOptions(SignatureHelpCapability capability, ClientCapabilities clientCapabilities) => new() + protected override SignatureHelpRegistrationOptions CreateRegistrationOptions(SignatureHelpCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), /* diff --git a/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs b/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs index 1ff8cd3fceb..24744213c52 100644 --- a/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs +++ b/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs @@ -2,8 +2,8 @@ // Licensed under the MIT License. using Bicep.Core; using Bicep.Core.Extensions; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Configuration; +using Bicep.LanguageServer.BicepConfig; +using Bicep.LanguageServer.Compilation; using Bicep.LanguageServer.Utils; using MediatR; using OmniSharp.Extensions.LanguageServer.Protocol; @@ -12,7 +12,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Language.TextDocumentSync { public class BicepTextDocumentSyncHandler : TextDocumentSyncHandlerBase { @@ -107,7 +107,7 @@ public override Task Handle(DidCloseTextDocumentParams request, Cancellati return Unit.Task; } - protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, ClientCapabilities clientCapabilities) => new() + protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { Change = TextDocumentSyncKind.Full, DocumentSelector = documentSelectorFactory.CreateForAllSupportedLangIds() diff --git a/src/Bicep.LangServer/Features/Workspace/DidChangeConfiguration/BicepDidChangeConfigurationHandler.cs b/src/Bicep.LangServer/Features/Workspace/DidChangeConfiguration/BicepDidChangeConfigurationHandler.cs index 93c57fde3df..e5f2ebc1f45 100644 --- a/src/Bicep.LangServer/Features/Workspace/DidChangeConfiguration/BicepDidChangeConfigurationHandler.cs +++ b/src/Bicep.LangServer/Features/Workspace/DidChangeConfiguration/BicepDidChangeConfigurationHandler.cs @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using Bicep.LanguageServer.Settings; using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OmniSharp.Extensions.JsonRpc; -namespace Bicep.LanguageServer.Settings +namespace Bicep.LanguageServer.Features.Workspace.DidChangeConfiguration { [Method("workspace/didChangeConfiguration", Direction.ClientToServer)] public record DidChangeConfigurationParams : IRequest diff --git a/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs b/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs index a87beef2e77..caaf0ec3982 100644 --- a/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs +++ b/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Bicep.Core; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Configuration; +using Bicep.LanguageServer.BicepConfig; +using Bicep.LanguageServer.Compilation; using MediatR; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; using FileSystemWatcher = OmniSharp.Extensions.LanguageServer.Protocol.Models.FileSystemWatcher; -namespace Bicep.LanguageServer.Handlers +namespace Bicep.LanguageServer.Features.Workspace.DidChangeWatchedFiles { public sealed class BicepDidChangeWatchedFilesHandler : DidChangeWatchedFilesHandlerBase { @@ -40,7 +40,7 @@ public override Task Handle(DidChangeWatchedFilesParams request, Cancellat return Unit.Task; } - protected override DidChangeWatchedFilesRegistrationOptions CreateRegistrationOptions(DidChangeWatchedFilesCapability capability, ClientCapabilities clientCapabilities) => new() + protected override DidChangeWatchedFilesRegistrationOptions CreateRegistrationOptions(DidChangeWatchedFilesCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() { Watchers = new Container( new FileSystemWatcher() diff --git a/src/Bicep.LangServer/IServiceCollectionExtensions.cs b/src/Bicep.LangServer/IServiceCollectionExtensions.cs index 8f3fba9eb6e..5d70636b4ff 100644 --- a/src/Bicep.LangServer/IServiceCollectionExtensions.cs +++ b/src/Bicep.LangServer/IServiceCollectionExtensions.cs @@ -16,17 +16,19 @@ using Bicep.Decompiler; using Bicep.IO.Abstraction; using Bicep.IO.FileSystem; -using Bicep.LanguageServer.CompilationManager; -using Bicep.LanguageServer.Completions; -using Bicep.LanguageServer.Configuration; -using Bicep.LanguageServer.Deploy; +using Bicep.LanguageServer.BicepConfig; +using Bicep.LanguageServer.ClientCapabilities; +using Bicep.LanguageServer.Compilation; +using Bicep.LanguageServer.Features.Custom.Deployments.Services; +using Bicep.LanguageServer.Features.Custom.InsertResource; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.LanguageServer.Features.Custom.Visualization; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Completion.Snippets; +using Bicep.LanguageServer.Features.Language.Definition; using Bicep.LanguageServer.Options; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Registry; using Bicep.LanguageServer.Settings; -using Bicep.LanguageServer.Snippets; -using Bicep.LanguageServer.Telemetry; using Bicep.LanguageServer.Utils; using Bicep.Local.Deploy.Azure; using Bicep.Local.Deploy.Extensibility; diff --git a/src/Bicep.LangServer/Server.cs b/src/Bicep.LangServer/Server.cs index 6cbc83f7141..010e81ac1a3 100644 --- a/src/Bicep.LangServer/Server.cs +++ b/src/Bicep.LangServer/Server.cs @@ -8,11 +8,36 @@ using Bicep.Core.Registry.Catalog; using Bicep.Core.Tracing; using Bicep.Core.Utils; +using Bicep.LanguageServer.Features.Custom.Build; +using Bicep.LanguageServer.Features.Custom.Configuration; +using Bicep.LanguageServer.Features.Custom.Decompile; +using Bicep.LanguageServer.Features.Custom.Deployments; +using Bicep.LanguageServer.Features.Custom.ImportKubernetesManifest; +using Bicep.LanguageServer.Features.Custom.InsertResource; +using Bicep.LanguageServer.Features.Custom.Linter; +using Bicep.LanguageServer.Features.Custom.LocalDeploy; +using Bicep.LanguageServer.Features.Custom.ModuleRestore; +using Bicep.LanguageServer.Features.Custom.Parameters; +using Bicep.LanguageServer.Features.Custom.Telemetry; using Bicep.LanguageServer.Features.Custom.Visualization; -using Bicep.LanguageServer.Handlers; +using Bicep.LanguageServer.Features.Language.CodeAction; +using Bicep.LanguageServer.Features.Language.CodeLens; +using Bicep.LanguageServer.Features.Language.Completion; +using Bicep.LanguageServer.Features.Language.Definition; +using Bicep.LanguageServer.Features.Language.DocumentFormatting; +using Bicep.LanguageServer.Features.Language.DocumentHighlight; +using Bicep.LanguageServer.Features.Language.DocumentLink; +using Bicep.LanguageServer.Features.Language.DocumentSymbol; +using Bicep.LanguageServer.Features.Language.Hover; +using Bicep.LanguageServer.Features.Language.PrepareRename; +using Bicep.LanguageServer.Features.Language.References; +using Bicep.LanguageServer.Features.Language.Rename; +using Bicep.LanguageServer.Features.Language.SemanticTokens; +using Bicep.LanguageServer.Features.Language.SignatureHelp; +using Bicep.LanguageServer.Features.Language.TextDocumentSync; +using Bicep.LanguageServer.Features.Workspace.DidChangeConfiguration; +using Bicep.LanguageServer.Features.Workspace.DidChangeWatchedFiles; using Bicep.LanguageServer.Options; -using Bicep.LanguageServer.Providers; -using Bicep.LanguageServer.Registry; using Bicep.LanguageServer.Settings; using Bicep.LanguageServer.Utils; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Bicep.LangServer/Settings/SettingsProvider.cs b/src/Bicep.LangServer/Settings/SettingsProvider.cs index bdacaa7bacd..2b838bb5d9f 100644 --- a/src/Bicep.LangServer/Settings/SettingsProvider.cs +++ b/src/Bicep.LangServer/Settings/SettingsProvider.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System.Collections.Concurrent; +using Bicep.LanguageServer.Features.Workspace.DidChangeConfiguration; namespace Bicep.LanguageServer.Settings { diff --git a/src/Bicep.LangServer/Utils/CompilationHelper.cs b/src/Bicep.LangServer/Utils/CompilationHelper.cs index 5c458515d8b..dd6a92809b5 100644 --- a/src/Bicep.LangServer/Utils/CompilationHelper.cs +++ b/src/Bicep.LangServer/Utils/CompilationHelper.cs @@ -3,7 +3,7 @@ using Bicep.Core; using Bicep.Core.Semantics; -using Bicep.LanguageServer.CompilationManager; +using Bicep.LanguageServer.Compilation; using OmniSharp.Extensions.LanguageServer.Protocol; namespace Bicep.LanguageServer.Utils @@ -19,7 +19,7 @@ public CompilationHelper(BicepCompiler bicepCompiler, ICompilationManager compil this.compilationManager = compilationManager; } - public async Task GetRefreshedCompilation(DocumentUri documentUri) + public async Task GetRefreshedCompilation(DocumentUri documentUri) { // Bicep file could contain load functions like loadTextContent(..). We'll refresh compilation to detect changes in files referenced in load functions. compilationManager.RefreshCompilation(documentUri, forceReloadAuxiliaryFiles: true); diff --git a/src/Bicep.LangServer/Utils/JsonEditor.cs b/src/Bicep.LangServer/Utils/JsonEditor.cs index 8bb109914b4..3a9434bcd64 100644 --- a/src/Bicep.LangServer/Utils/JsonEditor.cs +++ b/src/Bicep.LangServer/Utils/JsonEditor.cs @@ -8,7 +8,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; -namespace Bicep.LanguageServer.Configuration +namespace Bicep.LanguageServer.Utils { /// /// Allows for some limited JSON text manipulation without destroying commands or existing whitespace From 345532ac19debd1a95d1bc2ffe55e87911e7cb44 Mon Sep 17 00:00:00 2001 From: Shenglong Li Date: Mon, 10 Aug 2026 13:16:16 -0700 Subject: [PATCH 2/2] Use aliases for shadowed namespace types Replace inline fully qualified compiler and LSP type names with concise file-level aliases. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../ClientCapabilitiesProvider.cs | 5 ++-- .../Compilation/BicepCompilationProvider.cs | 3 +- .../Compilation/CompilationContext.cs | 5 ++-- .../BicepDeploymentScopeRequestHandler.cs | 3 +- .../DeploymentFileCompilationCache.cs | 9 +++--- .../IDeploymentFileCompilationCache.cs | 5 ++-- .../CodeAction/BicepCodeActionHandler.cs | 12 ++++---- .../Language/CodeLens/BicepCodeLensHandler.cs | 6 ++-- .../ExternalSourceCodeLensProvider.cs | 11 ++++---- .../Completion/BicepCompletionContext.cs | 3 +- .../Completion/BicepCompletionHandler.cs | 3 +- .../Completion/BicepCompletionProvider.cs | 13 +++++---- .../Completion/ICompletionProvider.cs | 3 +- .../Definition/BicepDefinitionHandler.cs | 3 +- .../BicepDocumentFormattingHandler.cs | 3 +- .../BicepDocumentHighlightHandler.cs | 6 ++-- .../BicepExternalSourceDocumentLinkHandler.cs | 6 ++-- .../BicepDocumentSymbolHandler.cs | 12 ++++---- .../Language/Hover/BicepHoverHandler.cs | 8 ++++-- .../BicepPrepareRenameHandler.cs | 3 +- .../References/BicepReferencesHandler.cs | 3 +- .../Language/Rename/BicepRenameHandler.cs | 3 +- .../BicepSemanticTokensHandler.cs | 3 +- .../BicepSignatureHelpHandler.cs | 28 ++++++++++--------- .../BicepTextDocumentSyncHandler.cs | 3 +- .../BicepDidChangeWatchedFilesHandler.cs | 3 +- .../Utils/CompilationHelper.cs | 3 +- 27 files changed, 101 insertions(+), 67 deletions(-) diff --git a/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs b/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs index 64e5ff0739b..81bcf3c10a4 100644 --- a/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs +++ b/src/Bicep.LangServer/ClientCapabilities/ClientCapabilitiesProvider.cs @@ -3,6 +3,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Server; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.ClientCapabilities { @@ -17,14 +18,14 @@ public ClientCapabilitiesProvider(ILanguageServerFacade server) public bool DoesClientSupportWorkspaceFolders() { - return server.Workspace.ClientSettings.Capabilities is global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilitites && + return server.Workspace.ClientSettings.Capabilities is LspClientCapabilities clientCapabilitites && clientCapabilitites.Workspace is WorkspaceClientCapabilities workspaceClientCapabilities && workspaceClientCapabilities.WorkspaceFolders.IsSupported; } public bool DoesClientSupportShowDocumentRequest() { - return server.ClientSettings.Capabilities is global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities && + return server.ClientSettings.Capabilities is LspClientCapabilities clientCapabilities && clientCapabilities.Window is WindowClientCapabilities windowClientCapabilities && windowClientCapabilities.ShowDocument.IsSupported; } diff --git a/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs b/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs index 9cb7e4fc9ee..60e93544d21 100644 --- a/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs +++ b/src/Bicep.LangServer/Compilation/BicepCompilationProvider.cs @@ -12,6 +12,7 @@ using Bicep.IO.Abstraction; using Microsoft.Extensions.DependencyInjection; using OmniSharp.Extensions.LanguageServer.Protocol; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Compilation { @@ -76,7 +77,7 @@ private CompilationContext CreateContext( SourceFileGrouping syntaxTreeGrouping, ImmutableDictionary modelLookup) { - var compilation = new global::Bicep.Core.Semantics.Compilation( + var compilation = new BicepCompilation( environment, namespaceProvider, syntaxTreeGrouping, diff --git a/src/Bicep.LangServer/Compilation/CompilationContext.cs b/src/Bicep.LangServer/Compilation/CompilationContext.cs index ea13b9751a6..2089739fc47 100644 --- a/src/Bicep.LangServer/Compilation/CompilationContext.cs +++ b/src/Bicep.LangServer/Compilation/CompilationContext.cs @@ -3,6 +3,7 @@ using System.Collections.Immutable; using Bicep.Core.Semantics; using Bicep.Core.Syntax; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Compilation { @@ -12,14 +13,14 @@ namespace Bicep.LanguageServer.Compilation /// public class CompilationContext : CompilationContextBase { - public CompilationContext(global::Bicep.Core.Semantics.Compilation compilation) + public CompilationContext(BicepCompilation compilation) // on a successful compilation, we can reuse the entry point file kind : base(compilation.SourceFileGrouping.EntryPoint.FileKind) { this.Compilation = compilation; } - public global::Bicep.Core.Semantics.Compilation Compilation { get; } + public BicepCompilation Compilation { get; } public ProgramSyntax ProgramSyntax => Compilation.SourceFileGrouping.EntryPoint.ProgramSyntax; diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs index c30b6c69bf0..c8ba9001088 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/BicepDeploymentScopeRequestHandler.cs @@ -15,6 +15,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Custom.Deployments { @@ -74,7 +75,7 @@ public override async Task Handle(BicepDeploymentS _ => resourceScope.ToString() }; - private string GetCompiledFile(global::Bicep.Core.Semantics.Compilation compilation, DocumentUri documentUri) + private string GetCompiledFile(BicepCompilation compilation, DocumentUri documentUri) { if (compilation.HasErrors()) { diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs index b6fd3677f74..43ea38a6fe5 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/DeploymentFileCompilationCache.cs @@ -4,21 +4,22 @@ using System.Collections.Concurrent; using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public class DeploymentFileCompilationCache : IDeploymentFileCompilationCache { - private readonly ConcurrentDictionary compilationCache = new(); + private readonly ConcurrentDictionary compilationCache = new(); - public void CacheCompilation(DocumentUri documentUri, global::Bicep.Core.Semantics.Compilation compilation) + public void CacheCompilation(DocumentUri documentUri, BicepCompilation compilation) { compilationCache.TryAdd(documentUri, compilation); } - public global::Bicep.Core.Semantics.Compilation? FindAndRemoveCompilation(DocumentUri documentUri) + public BicepCompilation? FindAndRemoveCompilation(DocumentUri documentUri) { - if (compilationCache.TryRemove(documentUri, out global::Bicep.Core.Semantics.Compilation? compilation) && compilation is not null) + if (compilationCache.TryRemove(documentUri, out BicepCompilation? compilation) && compilation is not null) { return compilation; } diff --git a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs index 905a39c0bf6..4ed1d126bf0 100644 --- a/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs +++ b/src/Bicep.LangServer/Features/Custom/Deployments/Services/IDeploymentFileCompilationCache.cs @@ -3,13 +3,14 @@ using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Custom.Deployments.Services { public interface IDeploymentFileCompilationCache { - public void CacheCompilation(DocumentUri documentUri, global::Bicep.Core.Semantics.Compilation compilation); + public void CacheCompilation(DocumentUri documentUri, BicepCompilation compilation); - public global::Bicep.Core.Semantics.Compilation? FindAndRemoveCompilation(DocumentUri documentUri); + public BicepCompilation? FindAndRemoveCompilation(DocumentUri documentUri); } } diff --git a/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs b/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs index 5ea123d69ae..d0caeab4d64 100644 --- a/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/CodeAction/BicepCodeActionHandler.cs @@ -25,6 +25,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspCodeAction = OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction; namespace Bicep.LanguageServer.Features.Language.CodeAction { @@ -185,7 +187,7 @@ private static IEnumerable GetDecoratorCodeFixProvider args: JArray.FromObject(new List { telemetryEvent }) ); - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction + return new LspCodeAction { Title = string.Format(LangServerResources.DisableDiagnosticForThisLine, diagnosticCode.String), Edit = new WorkspaceEdit @@ -201,7 +203,7 @@ private static IEnumerable GetDecoratorCodeFixProvider private static CommandOrCodeAction CreateEditLinterRuleAction(DocumentUri documentUri, string ruleName, IOUri? configFileIdentifier) { - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction + return new LspCodeAction { Title = String.Format(LangServerResources.EditLinterRuleActionTitle, ruleName), Command = TelemetryHelper.CreateCommand @@ -213,7 +215,7 @@ private static CommandOrCodeAction CreateEditLinterRuleAction(DocumentUri docume }; } - public override Task Handle(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction request, CancellationToken cancellationToken) + public override Task Handle(LspCodeAction request, CancellationToken cancellationToken) { // we are currently precomputing our quickfixes, so there's no need to resolve them after they are chosen // this shouldn't be called because registration options disabled the resolve functionality @@ -230,7 +232,7 @@ private static CommandOrCodeAction CreateCodeActionFromFix(DocumentUri uri, Comp _ => CodeActionKind.Empty, }; - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeAction + return new LspCodeAction { Kind = codeActionKind, Title = fix.Title, @@ -250,7 +252,7 @@ private static CommandOrCodeAction CreateCodeActionFromFix(DocumentUri uri, Comp }; } - protected override CodeActionRegistrationOptions CreateRegistrationOptions(CodeActionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override CodeActionRegistrationOptions CreateRegistrationOptions(CodeActionCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), CodeActionKinds = new Container(CodeActionKind.QuickFix), diff --git a/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs b/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs index cf1b7800def..004f0dd0c86 100644 --- a/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs +++ b/src/Bicep.LangServer/Features/Language/CodeLens/BicepCodeLensHandler.cs @@ -8,6 +8,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspCodeLens = OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens; namespace Bicep.LanguageServer.Features.Language.CodeLens { @@ -34,12 +36,12 @@ public BicepCodeLensHandler(IModuleDispatcher moduleDispatcher, ISourceFileFacto return Task.FromResult(new CodeLensContainer(lenses)); } - public override Task Handle(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens request, CancellationToken cancellationToken) + public override Task Handle(LspCodeLens request, CancellationToken cancellationToken) { throw new NotImplementedException(); } - protected override CodeLensRegistrationOptions CreateRegistrationOptions(CodeLensCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override CodeLensRegistrationOptions CreateRegistrationOptions(CodeLensCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = new( documentSelectorFactory.CreateForAllSupportedLangIds() diff --git a/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs b/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs index 3ea2a708c7b..1a1dd335c1c 100644 --- a/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs +++ b/src/Bicep.LangServer/Features/Language/CodeLens/ExternalSourceCodeLensProvider.cs @@ -12,6 +12,7 @@ using Newtonsoft.Json.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +using LspCodeLens = OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens; namespace Bicep.LanguageServer.Features.Language.CodeLens { @@ -20,7 +21,7 @@ public static class ExternalSourceCodeLensProvider { private static readonly Range DocumentStart = new(new Position(0, 0), new Position(0, 0)); - public static IEnumerable GetCodeLenses(IModuleDispatcher moduleDispatcher, ISourceFileFactory sourceFileFactory, CodeLensParams request, CancellationToken cancellationToken) + public static IEnumerable GetCodeLenses(IModuleDispatcher moduleDispatcher, ISourceFileFactory sourceFileFactory, CodeLensParams request, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -104,15 +105,15 @@ public static class ExternalSourceCodeLensProvider } } - global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens CreateErrorLens(string message) + LspCodeLens CreateErrorLens(string message) { return CreateCodeLens(DocumentStart, message); } } - private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens CreateCodeLens(Range range, string title, string? commandName = null, params string[] commandArguments) + private static LspCodeLens CreateCodeLens(Range range, string title, string? commandName = null, params string[] commandArguments) { - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens + return new LspCodeLens { Range = range, Command = new Command @@ -126,7 +127,7 @@ public static class ExternalSourceCodeLensProvider } // Allows tests to filter to just code lenses that were created by this provider - public static bool IsExternalSourceCodeLens(this global::OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLens codeLens) + public static bool IsExternalSourceCodeLens(this LspCodeLens codeLens) { return codeLens.Data?.Value() == nameof(ExternalSourceCodeLensProvider); } diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs index b5d1b663118..dc03fa4c930 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionContext.cs @@ -17,6 +17,7 @@ using Bicep.LanguageServer.Utils; using Microsoft.WindowsAzure.ResourceStack.Common.Extensions; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Language.Completion { @@ -141,7 +142,7 @@ private BicepCompletionContext( public IFeatureProvider Features { get; } - public static BicepCompletionContext Create(global::Bicep.Core.Semantics.Compilation compilation, int offset) + public static BicepCompletionContext Create(BicepCompilation compilation, int offset) { var model = compilation.GetEntrypointSemanticModel(); var bicepFile = model.SourceFile; diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs index 9c838da4c11..f116da26fbe 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionHandler.cs @@ -9,6 +9,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.Completion { @@ -59,7 +60,7 @@ public override Task Handle(CompletionItem request, Cancellation return this.completionProvider.Resolve(request, cancellationToken); } - protected override CompletionRegistrationOptions CreateRegistrationOptions(CompletionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override CompletionRegistrationOptions CreateRegistrationOptions(CompletionCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), AllCommitCharacters = new Container(), diff --git a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs index 089e053bb1d..eb2afb7a968 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/BicepCompletionProvider.cs @@ -30,6 +30,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; using SymbolKind = Bicep.Core.Semantics.SymbolKind; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Language.Completion { @@ -50,7 +51,7 @@ public BicepCompletionProvider(ISnippetsProvider snippetsProvider, IModuleRefere this.moduleReferenceCompletionProvider = moduleReferenceCompletionProvider; } - public async Task> GetFilteredCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken) + public async Task> GetFilteredCompletions(BicepCompilation compilation, BicepCompletionContext context, CancellationToken cancellationToken) { var model = compilation.GetEntrypointSemanticModel(); @@ -1219,7 +1220,7 @@ IEnumerable GetAccessible(IEnumerable symbols, T }; } - private static IEnumerable GetMemberAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetMemberAccessCompletions(BicepCompilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.MemberAccess) || context.PropertyAccess == null) { @@ -1252,7 +1253,7 @@ private static IEnumerable GetMemberAccessCompletions(global::Bi .Select(m => CreateSymbolCompletion(m, context.ReplacementRange, model))); } - private static IEnumerable GetTypeMemberAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetTypeMemberAccessCompletions(BicepCompilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.TypeMemberAccess) || context.TypePropertyAccess is null) { @@ -1286,7 +1287,7 @@ private static IEnumerable GetTypeMemberAccessCompletions(global return completions; } - private static IEnumerable GetTypeArrayIndexCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetTypeArrayIndexCompletions(BicepCompilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.TypeArrayIndex)) { @@ -1339,7 +1340,7 @@ private static IEnumerable GetTypeArrayIndexCompletions(global:: return []; } - private static IEnumerable GetResourceAccessCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetResourceAccessCompletions(BicepCompilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.ResourceAccess) || context.ResourceAccess == null) { @@ -1361,7 +1362,7 @@ private static IEnumerable GetResourceAccessCompletions(global:: .Select(entry => CreateSymbolCompletion(entry.symbol!, context.ReplacementRange, model)); } - private static IEnumerable GetArrayIndexCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context) + private static IEnumerable GetArrayIndexCompletions(BicepCompilation compilation, BicepCompletionContext context) { if (!context.Kind.HasFlag(BicepCompletionContextKind.ArrayIndex) || context.ArrayAccess == null) { diff --git a/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs b/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs index c65114e529a..9fdda91c795 100644 --- a/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs +++ b/src/Bicep.LangServer/Features/Language/Completion/ICompletionProvider.cs @@ -3,12 +3,13 @@ using Bicep.Core.Semantics; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Features.Language.Completion { public interface ICompletionProvider { - Task> GetFilteredCompletions(global::Bicep.Core.Semantics.Compilation compilation, BicepCompletionContext context, CancellationToken cancellationToken); + Task> GetFilteredCompletions(BicepCompilation compilation, BicepCompletionContext context, CancellationToken cancellationToken); Task Resolve(CompletionItem completionItem, CancellationToken cancellationToken) { diff --git a/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs b/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs index 77b8b94ecc4..2acf9d931b1 100644 --- a/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Definition/BicepDefinitionHandler.cs @@ -35,6 +35,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.Definition { @@ -87,7 +88,7 @@ ISourceFileFactory sourceFileFactory }; } - protected override DefinitionRegistrationOptions CreateRegistrationOptions(DefinitionCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DefinitionRegistrationOptions CreateRegistrationOptions(DefinitionCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs index f369732be04..79b88835535 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentFormatting/BicepDocumentFormattingHandler.cs @@ -11,6 +11,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.DocumentFormatting { @@ -64,7 +65,7 @@ public class BicepDocumentFormattingHandler( })); } - protected override DocumentFormattingRegistrationOptions CreateRegistrationOptions(DocumentFormattingCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DocumentFormattingRegistrationOptions CreateRegistrationOptions(DocumentFormattingCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs index d9f70f9914d..753a8c6e1b5 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentHighlight/BicepDocumentHighlightHandler.cs @@ -7,6 +7,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspDocumentHighlight = OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentHighlight; namespace Bicep.LanguageServer.Features.Language.DocumentHighlight { @@ -22,7 +24,7 @@ public class BicepDocumentHighlightHandler(ISymbolResolver symbolResolver, Docum var highlights = result.Context.Compilation.GetEntrypointSemanticModel() .FindReferences(result.Symbol) - .Select(referenceSyntax => new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentHighlight + .Select(referenceSyntax => new LspDocumentHighlight { Range = PositionHelper.GetNameRange(result.Context.LineStarts, referenceSyntax), Kind = referenceSyntax switch @@ -36,7 +38,7 @@ public class BicepDocumentHighlightHandler(ISymbolResolver symbolResolver, Docum return Task.FromResult(new DocumentHighlightContainer(highlights)); } - protected override DocumentHighlightRegistrationOptions CreateRegistrationOptions(DocumentHighlightCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DocumentHighlightRegistrationOptions CreateRegistrationOptions(DocumentHighlightCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs index 027d1ea7b20..2d86aaab26b 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentLink/BicepExternalSourceDocumentLinkHandler.cs @@ -20,6 +20,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Window; using static Bicep.Core.Diagnostics.DiagnosticBuilder; using static Bicep.LanguageServer.Features.Custom.Telemetry.BicepTelemetryEvent; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspDocumentLink = OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentLink; namespace Bicep.LanguageServer.Features.Language.DocumentLink { @@ -61,7 +63,7 @@ protected override async Task> Hand return await ResolveDocumentLink(request, ModuleDispatcher, sourceFileFactory, Server, TelemetryProvider); } - protected override DocumentLinkRegistrationOptions CreateRegistrationOptions(DocumentLinkCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DocumentLinkRegistrationOptions CreateRegistrationOptions(DocumentLinkCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = TextDocumentSelector.ForScheme(LangServerConstants.ExternalSourceFileScheme), ResolveProvider = true, @@ -118,7 +120,7 @@ public static IEnumerable> GetDocum } else { - yield return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentLink() + yield return new LspDocumentLink() { // This is a link to a file that we don't have source for, so we'll just display the main.json file Range = nestedLink.Range.ToRange(), diff --git a/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs b/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs index 65219f32d5f..a070f0dd465 100644 --- a/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs +++ b/src/Bicep.LangServer/Features/Language/DocumentSymbol/BicepDocumentSymbolHandler.cs @@ -12,6 +12,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using SymbolKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.SymbolKind; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspDocumentSymbol = OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbol; namespace Bicep.LanguageServer.Features.Language.DocumentSymbol { @@ -51,9 +53,9 @@ private IEnumerable GetSymbols(CompilationCon .Select(symbol => new SymbolInformationOrDocumentSymbol(CreateDocumentSymbol(model, symbol, context.LineStarts))); } - private global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol symbol, ImmutableArray lineStarts) + private LspDocumentSymbol CreateDocumentSymbol(SemanticModel model, DeclaredSymbol symbol, ImmutableArray lineStarts) { - var children = Enumerable.Empty(); + var children = Enumerable.Empty(); if (symbol is ResourceSymbol resourceSymbol && resourceSymbol.DeclaringResource.TryGetBody() is ObjectSyntax body) { @@ -63,12 +65,12 @@ private IEnumerable GetSymbols(CompilationCon .Select(s => CreateDocumentSymbol(model, s!, lineStarts)); } - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbol + return new LspDocumentSymbol { Name = symbol.Name, Kind = SelectSymbolKind(symbol), Detail = FormatDetail(symbol), - Children = new Container(children), + Children = new Container(children), Range = symbol.DeclaringSyntax.ToRange(lineStarts), // use the name node span with fallback to entire declaration span SelectionRange = symbol.NameSource.ToRange(lineStarts) @@ -107,7 +109,7 @@ private IEnumerable GetSymbols(CompilationCon _ => string.Empty, }; - protected override DocumentSymbolRegistrationOptions CreateRegistrationOptions(DocumentSymbolCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DocumentSymbolRegistrationOptions CreateRegistrationOptions(DocumentSymbolCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs b/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs index 95a379bb076..16f335f302a 100644 --- a/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Hover/BicepHoverHandler.cs @@ -19,6 +19,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspHover = OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover; namespace Bicep.LanguageServer.Features.Language.Hover { @@ -44,7 +46,7 @@ public BicepHoverHandler( this.documentSelectorFactory = documentSelectorFactory; } - public override async Task Handle(HoverParams request, CancellationToken cancellationToken) + public override async Task Handle(HoverParams request, CancellationToken cancellationToken) { // ResolveSymbol returns null over a resource type string; fall back to show the resource hover there. var result = this.symbolResolver.ResolveSymbol(request.TextDocument.Uri, request.Position) @@ -60,7 +62,7 @@ public BicepHoverHandler( return null; } - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover + return new LspHover { Contents = markdown, Range = PositionHelper.GetNameRange(result.Context.LineStarts, result.Origin) @@ -373,7 +375,7 @@ private static string GetFunctionOverloadMarkdown(FunctionOverload overload) private static MarkedStringsOrMarkupContent AsMarkdown(IEnumerable markdown) => new(markdown.Select(md => new MarkedString(md))); - protected override HoverRegistrationOptions CreateRegistrationOptions(HoverCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override HoverRegistrationOptions CreateRegistrationOptions(HoverCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs b/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs index c64f53f618f..d1144104e4b 100644 --- a/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs +++ b/src/Bicep.LangServer/Features/Language/PrepareRename/BicepPrepareRenameHandler.cs @@ -7,6 +7,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.PrepareRename { @@ -38,7 +39,7 @@ public BicepPrepareRenameHandler(ISymbolResolver symbolResolver, DocumentSelecto }); } - protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, LspClientCapabilities clientCapabilities) => new() { // textDocument/prepareRename is advertised through renameProvider.prepareProvider. // BicepRenameHandler owns that advertisement; registering a second document selector here diff --git a/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs b/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs index 482267b9d53..a44aa926e65 100644 --- a/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs +++ b/src/Bicep.LangServer/Features/Language/References/BicepReferencesHandler.cs @@ -7,6 +7,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.References { @@ -39,7 +40,7 @@ public class BicepReferencesHandler(ISymbolResolver symbolResolver, DocumentSele return new(references); } - protected override ReferenceRegistrationOptions CreateRegistrationOptions(ReferenceCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override ReferenceRegistrationOptions CreateRegistrationOptions(ReferenceCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams() }; diff --git a/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs b/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs index 3ccfd2e7ef3..f791529ed1c 100644 --- a/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs +++ b/src/Bicep.LangServer/Features/Language/Rename/BicepRenameHandler.cs @@ -14,6 +14,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.Rename { @@ -96,7 +97,7 @@ internal static SymbolResolutionResult ResolveRenameableSymbol(ISymbolResolver s } } - protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override RenameRegistrationOptions CreateRegistrationOptions(RenameCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = this.documentSelectorFactory.CreateForBicepAndParams(), PrepareProvider = true diff --git a/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs b/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs index 5469b6dd32e..2ef8f3dea0c 100644 --- a/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs +++ b/src/Bicep.LangServer/Features/Language/SemanticTokens/BicepSemanticTokensHandler.cs @@ -10,6 +10,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using BicepTokenType = Bicep.Core.Highlighting.SemanticTokenType; using LspTokenType = OmniSharp.Extensions.LanguageServer.Protocol.Models.SemanticTokenType; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.SemanticTokens { @@ -81,7 +82,7 @@ public static void BuildSemanticTokens(SemanticTokensBuilder builder, SemanticMo _ => throw new NotImplementedException($"No mapping for token type {tokenType}"), }; - protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(SemanticTokensCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(SemanticTokensCapability capability, LspClientCapabilities clientCapabilities) => new() { // the semantic tokens handler requests don't get routed like other handlers // it seems we can only have one and it must be shared between all the language IDs we support diff --git a/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs b/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs index ebca09e122d..c660b43e206 100644 --- a/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs +++ b/src/Bicep.LangServer/Features/Language/SignatureHelp/BicepSignatureHelpHandler.cs @@ -16,6 +16,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; +using LspSignatureHelp = OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp; namespace Bicep.LanguageServer.Features.Language.SignatureHelp { @@ -26,7 +28,7 @@ public class BicepSignatureHelpHandler(ICompilationManager compilationManager, D private const string TypeArgumentsStart = "<"; private const string TypeArgumentsEnd = ">"; - public override Task Handle(SignatureHelpParams request, CancellationToken cancellationToken) + public override Task Handle(SignatureHelpParams request, CancellationToken cancellationToken) { // local function @@ -48,7 +50,7 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation }; } - private static Task NoHelp() => Task.FromResult(null); + private static Task NoHelp() => Task.FromResult(null); private static SyntaxBase? GetActiveSyntaxInNeedOfSignatureHelp(ProgramSyntax syntax, int offset) { @@ -80,7 +82,7 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation return null; } - private static Task Handle(CompilationContext context, + private static Task Handle(CompilationContext context, FunctionCallSyntaxBase functionCall, int offset, SignatureHelpParams request) @@ -106,10 +108,10 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation var signatureHelp = CreateSignatureHelp(functionCall.Arguments, normalizedArgumentTypes, functionSymbol, offset, includeReturnType); signatureHelp = TryReuseActiveSignature(request.Context, signatureHelp); - return Task.FromResult(signatureHelp); + return Task.FromResult(signatureHelp); } - private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp TryReuseActiveSignature(SignatureHelpContext? context, global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp signatureHelp) + private static LspSignatureHelp TryReuseActiveSignature(SignatureHelpContext? context, LspSignatureHelp signatureHelp) { if (context?.ActiveSignatureHelp == null || string.Equals(context.TriggerCharacter, FunctionArgumentStart, StringComparison.Ordinal) || @@ -133,7 +135,7 @@ ParameterizedTypeInstantiationSyntaxBase typeInstantiation return signatureHelp; } - private static bool CheckIfSignatureHelpSimilar(global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp active, global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp @new) + private static bool CheckIfSignatureHelpSimilar(LspSignatureHelp active, LspSignatureHelp @new) { // local function static string GetFunctionName(SignatureInformation info) @@ -165,7 +167,7 @@ private static List NormalizeArgumentTypes(ImmutableArray arguments, List normalizedArgumentTypes, IFunctionSymbol symbol, int offset, bool includeReturnType) + private static LspSignatureHelp CreateSignatureHelp(ImmutableArray arguments, List normalizedArgumentTypes, IFunctionSymbol symbol, int offset, bool includeReturnType) { // exclude overloads where the specified arguments have exceeded the maximum // allow count mismatches because the user may not have started typing the arguments yet @@ -181,7 +183,7 @@ private static List NormalizeArgumentTypes(ImmutableArray tuple.result == FunctionMatchResult.PotentialMatch); } - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp + return new LspSignatureHelp { Signatures = new Container(matchingOverloads.Select(tuple => CreateSignature(tuple.overload, arguments, includeReturnType))), ActiveSignature = activeSignatureIndex < 0 ? (int?)null : activeSignatureIndex, @@ -277,7 +279,7 @@ private static void AppendParameter(StringBuilder typeSignature, List Handle(CompilationContext context, + private static Task Handle(CompilationContext context, ParameterizedTypeInstantiationSyntaxBase typeInstantiation, int offset) { @@ -295,7 +297,7 @@ private static void AppendParameter(StringBuilder typeSignature, List null, }; - return Task.FromResult(CreateSignatureHelp(parameterizable, documentation, typeInstantiation.Arguments, offset)); + return Task.FromResult(CreateSignatureHelp(parameterizable, documentation, typeInstantiation.Arguments, offset)); } private static TypeSymbol? GetSymbolType(Symbol? symbol) => symbol switch @@ -306,9 +308,9 @@ private static void AppendParameter(StringBuilder typeSignature, List null, }; - private static global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp CreateSignatureHelp(TypeTemplate typeTemplate, string? documentation, ImmutableArray arguments, int offset) + private static LspSignatureHelp CreateSignatureHelp(TypeTemplate typeTemplate, string? documentation, ImmutableArray arguments, int offset) { - return new global::OmniSharp.Extensions.LanguageServer.Protocol.Models.SignatureHelp + return new LspSignatureHelp { Signatures = new Container(CreateSignature(typeTemplate, documentation)), ActiveSignature = 0, @@ -362,7 +364,7 @@ private static SignatureInformation CreateSignature(TypeTemplate typeTemplate, s }; } - protected override SignatureHelpRegistrationOptions CreateRegistrationOptions(SignatureHelpCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override SignatureHelpRegistrationOptions CreateRegistrationOptions(SignatureHelpCapability capability, LspClientCapabilities clientCapabilities) => new() { DocumentSelector = documentSelectorFactory.CreateForBicepAndParams(), /* diff --git a/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs b/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs index 24744213c52..d884ded15e9 100644 --- a/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs +++ b/src/Bicep.LangServer/Features/Language/TextDocumentSync/BicepTextDocumentSyncHandler.cs @@ -11,6 +11,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Language.TextDocumentSync { @@ -107,7 +108,7 @@ public override Task Handle(DidCloseTextDocumentParams request, Cancellati return Unit.Task; } - protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, LspClientCapabilities clientCapabilities) => new() { Change = TextDocumentSyncKind.Full, DocumentSelector = documentSelectorFactory.CreateForAllSupportedLangIds() diff --git a/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs b/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs index caaf0ec3982..839a1a36337 100644 --- a/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs +++ b/src/Bicep.LangServer/Features/Workspace/DidChangeWatchedFiles/BicepDidChangeWatchedFilesHandler.cs @@ -8,6 +8,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; using FileSystemWatcher = OmniSharp.Extensions.LanguageServer.Protocol.Models.FileSystemWatcher; +using LspClientCapabilities = OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities; namespace Bicep.LanguageServer.Features.Workspace.DidChangeWatchedFiles { @@ -40,7 +41,7 @@ public override Task Handle(DidChangeWatchedFilesParams request, Cancellat return Unit.Task; } - protected override DidChangeWatchedFilesRegistrationOptions CreateRegistrationOptions(DidChangeWatchedFilesCapability capability, global::OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities.ClientCapabilities clientCapabilities) => new() + protected override DidChangeWatchedFilesRegistrationOptions CreateRegistrationOptions(DidChangeWatchedFilesCapability capability, LspClientCapabilities clientCapabilities) => new() { Watchers = new Container( new FileSystemWatcher() diff --git a/src/Bicep.LangServer/Utils/CompilationHelper.cs b/src/Bicep.LangServer/Utils/CompilationHelper.cs index dd6a92809b5..6c36d220ab1 100644 --- a/src/Bicep.LangServer/Utils/CompilationHelper.cs +++ b/src/Bicep.LangServer/Utils/CompilationHelper.cs @@ -5,6 +5,7 @@ using Bicep.Core.Semantics; using Bicep.LanguageServer.Compilation; using OmniSharp.Extensions.LanguageServer.Protocol; +using BicepCompilation = Bicep.Core.Semantics.Compilation; namespace Bicep.LanguageServer.Utils { @@ -19,7 +20,7 @@ public CompilationHelper(BicepCompiler bicepCompiler, ICompilationManager compil this.compilationManager = compilationManager; } - public async Task GetRefreshedCompilation(DocumentUri documentUri) + public async Task GetRefreshedCompilation(DocumentUri documentUri) { // Bicep file could contain load functions like loadTextContent(..). We'll refresh compilation to detect changes in files referenced in load functions. compilationManager.RefreshCompilation(documentUri, forceReloadAuxiliaryFiles: true);