-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test support for LSP based editor
- Loading branch information
Showing
14 changed files
with
109 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...VisualStudio/IntegrationTest/IntegrationTests/LanguageServerProtocol/LspGoToDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Test.Utilities; | ||
using Microsoft.VisualStudio.IntegrationTest.Utilities; | ||
using Microsoft.VisualStudio.IntegrationTest.Utilities.Common; | ||
using Roslyn.Test.Utilities; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; | ||
|
||
namespace Roslyn.VisualStudio.IntegrationTests.LanguageServerProtocol | ||
{ | ||
[Collection(nameof(SharedIntegrationHostFixture))] | ||
public class LspGoToDefinition : AbstractEditorTest | ||
{ | ||
protected override string LanguageName => LanguageNames.CSharp; | ||
|
||
public LspGoToDefinition(VisualStudioInstanceFactory instanceFactory) | ||
: base(instanceFactory, nameof(LspGoToDefinition)) | ||
{ | ||
} | ||
|
||
[WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition), Trait(Traits.Editor, Traits.Editors.LanguageServerProtocol)] | ||
public void GoToDefinitionLSP() | ||
{ | ||
var project = new ProjectUtils.Project(ProjectName); | ||
VisualStudio.SolutionExplorer.AddFile(project, "FileDef.cs"); | ||
VisualStudio.SolutionExplorer.OpenFile(project, "FileDef.cs"); | ||
VisualStudio.Editor.SetText( | ||
@"class SomeClass | ||
{ | ||
} | ||
"); | ||
VisualStudio.SolutionExplorer.CloseCodeFile(project, "FileDef.cs", saveFile: true); | ||
VisualStudio.SolutionExplorer.AddFile(project, "FileConsumer.cs"); | ||
VisualStudio.SolutionExplorer.OpenFile(project, "FileConsumer.cs"); | ||
VisualStudio.Editor.SetText( | ||
@"class SomeOtherClass | ||
{ | ||
SomeClass sc; | ||
}"); | ||
VisualStudio.Editor.PlaceCaret("SomeClass"); | ||
VisualStudio.Editor.GoToDefinition("FileDef.cs"); | ||
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); | ||
VisualStudio.Editor.Verify.TextContains(@"class SomeClass$$", assertCaretPosition: true); | ||
Assert.True(VisualStudio.Shell.IsActiveTabProvisional()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters