diff --git a/azure-pipelines-integration-dartlab.yml b/azure-pipelines-integration-dartlab.yml index 1f6926648b39f..d11a54d2db80d 100644 --- a/azure-pipelines-integration-dartlab.yml +++ b/azure-pipelines-integration-dartlab.yml @@ -24,6 +24,14 @@ resources: trigger: - main +parameters: + - name: prNumber + type: string + default: '' + - name: sha + type: string + default: '' + variables: - name: XUNIT_LOGS value: $(Build.SourcesDirectory)\artifacts\log\$(_configuration) @@ -33,8 +41,21 @@ variables: value: true stages: +- ${{ if ne(parameters.prNumber, '') }}: + - stage: GitHubCommentFirst + jobs: + - job: GitHubCommentFirstJob + steps: + - task: GitHubComment@0 + inputs: + gitHubConnection: 'dotnet-comment-bot-service-connection' + repositoryName: '$(Build.Repository.Name)' + id: ${{ parameters.prNumber }} + comment: 'Started DartLab pipeline [run]($(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)) for ${{ parameters.sha }}' + - template: \stages\visual-studio\agent.yml@DartLabTemplates parameters: + name: VSIntegration displayName: VS Integration testLabPoolName: VS-Platform visualStudioBootstrapperURI: https://vsdrop.corp.microsoft.com/file/v1/$(VisualStudio.BuildUnderTest.ProductsDropName);bootstrappers/Enterprise/vs_enterprise.exe @@ -67,9 +88,37 @@ stages: arguments: -DropNamePrefix 'Products' -VstsDropUrlsJson '$(Pipeline.Workspace)\VisualStudioBuildUnderTest\BuildArtifacts\VstsDropUrls.json' -OutVariableName 'VisualStudio.BuildUnderTest.ProductsDropName' deployAndRunTestsStepList: - checkout: RoslynMirror + fetchDepth: 1 + fetchTags: false - template: eng/pipelines/test-integration-job.yml parameters: configuration: $(_configuration) oop64bit: $(_oop64bit) lspEditor: false skipCheckout: true + +- ${{ if ne(parameters.prNumber, '') }}: + - stage: GitHubCommentCompleted + condition: always() + dependsOn: VSIntegration + jobs: + - job: GitHubCommentCompletedSuccessfullyJob + condition: eq(stageDependencies.VSIntegration.result, 'Succeeded') + steps: + - checkout: none + - task: GitHubComment@0 + inputs: + gitHubConnection: 'dotnet-comment-bot-service-connection' + repositoryName: '$(Build.Repository.Name)' + id: ${{ parameters.prNumber }} + comment: 'DartLab pipeline [run]($(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)) completed successfully for ${{ parameters.sha }}' + - job: GitHubCommentCompletedUnsuccessfullyJob + condition: ne(stageDependencies.VSIntegration.result, 'Succeeded') + steps: + - checkout: none + - task: GitHubComment@0 + inputs: + gitHubConnection: 'dotnet-comment-bot-service-connection' + repositoryName: '$(Build.Repository.Name)' + id: ${{ parameters.prNumber }} + comment: 'DartLab pipeline [run]($(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)) did not complete successfully for ${{ parameters.sha }}' \ No newline at end of file diff --git a/src/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OptionList.cs b/src/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OptionList.cs index b5e15a8ebe982..6a41356e176e3 100644 --- a/src/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OptionList.cs +++ b/src/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OptionList.cs @@ -53,6 +53,7 @@ internal partial class DidChangeConfigurationNotificationHandler SolutionCrawlerOptionsStorage.CompilerDiagnosticsScopeOption, LspOptionsStorage.LspEnableReferencesCodeLens, LspOptionsStorage.LspEnableTestsCodeLens, + LspOptionsStorage.LspEnableOnAutoInsert, LanguageServerProjectSystemOptionsStorage.BinaryLogPath, LanguageServerProjectSystemOptionsStorage.EnableAutomaticRestore, ]; diff --git a/src/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs b/src/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs index 0e8cfb9fe6f41..b8bb6af64580b 100644 --- a/src/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs +++ b/src/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs @@ -50,6 +50,10 @@ internal sealed class OnAutoInsertHandler( if (document == null) return SpecializedTasks.Null(); + var onAutoInsertEnabled = _globalOptions.GetOption(LspOptionsStorage.LspEnableOnAutoInsert, document.Project.Language); + if (!onAutoInsertEnabled) + return SpecializedTasks.Null(); + var servicesForDocument = _braceCompletionServices.Where(s => s.Metadata.Language == document.Project.Language).SelectAsArray(s => s.Value); var isRazorRequest = context.ServerKind == WellKnownLspServerKinds.RazorLspServer; var position = ProtocolConversions.PositionToLinePosition(request.Position); diff --git a/src/LanguageServer/Protocol/LspOptionsStorage.cs b/src/LanguageServer/Protocol/LspOptionsStorage.cs index 0dde83ac8fb59..7ee3254b9f01a 100644 --- a/src/LanguageServer/Protocol/LspOptionsStorage.cs +++ b/src/LanguageServer/Protocol/LspOptionsStorage.cs @@ -32,6 +32,8 @@ internal sealed class LspOptionsStorage private static readonly OptionGroup s_codeLensOptionGroup = new(name: "code_lens", description: ""); + private static readonly OptionGroup s_onAutoInsertOptionGroup = new(name: "on_auto_insert", description: ""); + /// /// Flag indicating whether or not references should be returned in LSP codelens. /// @@ -41,5 +43,10 @@ internal sealed class LspOptionsStorage /// Flag indicating whether or not test and debug code lens items should be returned. /// public static readonly PerLanguageOption2 LspEnableTestsCodeLens = new("dotnet_enable_tests_code_lens", defaultValue: true, group: s_codeLensOptionGroup); + + /// + /// Flag indicating whether or not auto-insert should be abled by default in LSP. + /// + public static readonly PerLanguageOption2 LspEnableOnAutoInsert = new("dotnet_enable_on_auto_insert", defaultValue: true, group: s_onAutoInsertOptionGroup); } }