├── images ├── QuickFix.gif ├── AutoComplete.png ├── Create_Project.png ├── TestExplorer.png ├── Create_FileType.png ├── VS_Installation.png ├── Syntax_highlighting.png └── TestExplorerOptions.png ├── Gauge.VisualStudio ├── Key.snk ├── logo.png ├── Resources │ └── Package.ico ├── assets │ └── glyphs │ │ ├── step.png │ │ └── concept.png ├── Gauge.VisualStudio.licenseheader ├── template-report.xml ├── paket.references ├── Loggers │ └── StatusBarLogger.cs ├── app.config ├── Highlighting │ ├── IGaugeErrorTag.cs │ ├── UnimplementedStepTag.cs │ ├── DuplicateStepImplementationTag.cs │ ├── ImplementStepAction.cs │ └── StepTaggerProvider.cs ├── Guids.cs ├── GlobalSuppressions.cs ├── UI │ ├── Theme │ │ └── Generic.xaml │ ├── Refactor.xaml.cs │ ├── Refactor.xaml │ ├── ClassPicker.xaml │ └── ClassPicker.xaml.cs ├── Classification │ ├── ClassifierProvider.cs │ ├── Types.cs │ └── Formats.cs ├── GaugeClassifierProvider.cs ├── GaugeDaemonOptions.cs ├── Properties │ └── AssemblyInfo.cs ├── GaugeContentTypeDefinitions.cs ├── GaugeLanguageInfo.cs ├── source.extension.vsixmanifest ├── Autocomplete │ ├── GaugeCompletionSet.cs │ └── CompletionSource.cs ├── Resources.Designer.cs ├── Format │ └── FormatCommandFilter.cs ├── CommandController.cs ├── GotoDefn │ └── GotoDefnCommandFilter.cs ├── GaugePackage.cs └── References │ └── FindReferencesCommandFilter.cs ├── .paket ├── paket.bootstrapper.exe └── paket.targets ├── Gauge.VisualStudio.Core.Tests ├── paket.references ├── Gauge.VisualStudio.licenseheader ├── Properties │ └── AssemblyInfo.cs ├── Helpers │ └── DTEHelperTests.cs ├── Exceptions │ ├── GaugeApiInitializationExceptionTests.cs │ └── GaugeExceptionTests.cs ├── Extensions │ └── StringExtensionTests.cs ├── GaugeVersionTests.cs └── Gauge.VisualStudio.Core.Tests.csproj ├── Gauge.VisualStudio.Core ├── core.snk ├── paket.references ├── Gauge.VisualStudio.licenseheader ├── GaugeDisplayErrorLevel.cs ├── GaugePlugin.cs ├── GaugeVersionInfo.cs ├── Helpers │ ├── NativeMethods.cs │ └── GaugeProjectProperties.cs ├── Exceptions │ ├── GaugeVersionNotFoundException.cs │ ├── GaugeVersionIncompatibleException.cs │ ├── GaugeAPIInitializationException.cs │ └── GaugeExceptionBase.cs ├── IGaugeProcess.cs ├── IGaugeService.cs ├── Properties │ └── AssemblyInfo.cs ├── Extensions │ ├── DocumentExtensions.cs │ ├── StringExtensions.cs │ └── ProjectExtensions.cs ├── Loggers │ └── OutputPaneLogger.cs └── GaugeVersion.cs ├── Gauge.VisualStudio.Model ├── model.snk ├── paket.references ├── Gauge.VisualStudio.licenseheader ├── IStep.cs ├── StepImplementation.cs ├── IGaugeServiceClient.cs ├── Implementation.cs ├── Extensions │ ├── TextSnapshotExtensions.cs │ └── ProjectItemExtensions.cs ├── IProject.cs ├── ConceptImplementation.cs ├── Properties │ └── AssemblyInfo.cs ├── ProjectFactory.cs ├── Specification.cs ├── Concept.cs ├── Step.cs └── GaugeServiceClient.cs ├── Gauge.VisualStudio.TestAdapter ├── key.snk ├── paket.references ├── Gauge.VisualStudio.licenseheader ├── IGaugeRunner.cs ├── IGaugeTestRunSettingsService.cs ├── TableInfo.cs ├── TestExecutionError.cs ├── Properties │ └── AssemblyInfo.cs ├── TestExecutionResult.cs ├── TestExecutionEvent.cs ├── GaugeTestRunSettings.cs ├── TestContainer.cs ├── TestExecutor.cs ├── TestContainerDiscoverer.cs └── GaugeTestRunSettingsService.cs ├── Gauge.VisualStudio.Tests ├── paket.references ├── Gauge.VisualStudio.licenseheader └── Properties │ └── AssemblyInfo.cs ├── .gitignore ├── Gauge.VisualStudio.Model.Tests ├── app.config ├── paket.references ├── Gauge.VisualStudio.licenseheader ├── Properties │ └── AssemblyInfo.cs └── StepTests.cs ├── notice.md ├── appveyor.yml ├── release.sh ├── .github └── issue_template.md ├── version_nightly.ps1 ├── CONTRIBUTING.md ├── test.ps1 ├── paket.dependencies ├── CODE_OF_CONDUCT.md └── Gauge.VisualStudio.sln /images/QuickFix.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/QuickFix.gif -------------------------------------------------------------------------------- /images/AutoComplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/AutoComplete.png -------------------------------------------------------------------------------- /images/Create_Project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/Create_Project.png -------------------------------------------------------------------------------- /images/TestExplorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/TestExplorer.png -------------------------------------------------------------------------------- /Gauge.VisualStudio/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio/Key.snk -------------------------------------------------------------------------------- /Gauge.VisualStudio/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio/logo.png -------------------------------------------------------------------------------- /images/Create_FileType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/Create_FileType.png -------------------------------------------------------------------------------- /images/VS_Installation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/VS_Installation.png -------------------------------------------------------------------------------- /.paket/paket.bootstrapper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/.paket/paket.bootstrapper.exe -------------------------------------------------------------------------------- /images/Syntax_highlighting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/Syntax_highlighting.png -------------------------------------------------------------------------------- /images/TestExplorerOptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/images/TestExplorerOptions.png -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/paket.references: -------------------------------------------------------------------------------- 1 | Microsoft.Net.Compilers 2 | 3 | group Test 4 | FakeItEasy 5 | NUnit 6 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/core.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio.Core/core.snk -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/model.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio.Model/model.snk -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio.TestAdapter/key.snk -------------------------------------------------------------------------------- /Gauge.VisualStudio/Resources/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio/Resources/Package.ico -------------------------------------------------------------------------------- /Gauge.VisualStudio/assets/glyphs/step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio/assets/glyphs/step.png -------------------------------------------------------------------------------- /Gauge.VisualStudio/assets/glyphs/concept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getgauge/gauge-visualstudio/HEAD/Gauge.VisualStudio/assets/glyphs/concept.png -------------------------------------------------------------------------------- /Gauge.VisualStudio.Tests/paket.references: -------------------------------------------------------------------------------- 1 | VSSDK.CoreUtility 2 | VSSDK.DTE 3 | VSSDK.IDE 4 | VSSDK.IDE.12 5 | VSSDK.Text 6 | Microsoft.Net.Compilers 7 | 8 | group Test 9 | FakeItEasy 10 | NUnit 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.sln.DotSettings 5 | *.sln.DotSettings.user 6 | *.psess 7 | packages 8 | artifacts 9 | *.nupkg 10 | *.csproj.user 11 | Gauge.VisualStudio.sln.ide/ 12 | .paket/paket.exe 13 | paket-files 14 | .vs -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model.Tests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model.Tests/paket.references: -------------------------------------------------------------------------------- 1 | VSSDK.CoreUtility 2 | VSSDK.CoreUtility.12 3 | VSSDK.DTE 4 | VSSDK.IDE 5 | VSSDK.IDE.12 6 | VSSDK.Text 7 | VSSDK.Text.12 8 | Google.Protobuf 9 | Microsoft.Net.Compilers 10 | 11 | group Test 12 | 13 | FakeItEasy 14 | NUnit -------------------------------------------------------------------------------- /notice.md: -------------------------------------------------------------------------------- 1 | | Dependency Name | Copyright Information | Description | Repo URL | License Type | License URL | 2 | |-----------------|-----------------------|-------------|----------|--------------|-------------| 3 | |Google.ProtocolBuffers|Copyright 2008-2010 Google Inc.|C# port of protocol buffers|https://code.google.com/p/protobuf-csharp-port/|BSD 3 clause|http://opensource.org/licenses/BSD-3-Clause| 4 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/paket.references: -------------------------------------------------------------------------------- 1 | Gauge.CSharp.Core 2 | Gauge.CSharp.Lib 3 | Google.Protobuf 4 | VSSDK.CoreUtility 5 | VSSDK.DTE 6 | VSSDK.IDE 7 | VSSDK.IDE.12 8 | VSSDK.OLE.Interop 9 | VSSDK.Shell.Interop 10 | VSSDK.Shell.Interop.12 11 | VSSDK.Text 12 | VSSDK.TextManager.Interop 13 | VSSDK.TextManager.Interop.8 14 | VSSDK.VSLangProj 15 | EnvDTE80 16 | VSSDK.Shell.Immutable.10 17 | VSSDK.Shell.12 18 | Microsoft.Net.Compilers -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | os: Visual Studio 2017 3 | environment: 4 | MSBUILD_VERBOSITY: normal 5 | build_script: 6 | - ps: .\build.ps1 7 | test_script: 8 | - ps: .\test.ps1 9 | artifacts: 10 | - path: artifacts/Gauge.VisualStudio.vsix 11 | name: Gauge.VisualStudio 12 | on_finish: 13 | - ps: >- 14 | # upload results to AppVeyor 15 | 16 | $wc = New-Object 'System.Net.WebClient' 17 | 18 | $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\artifacts\gauge.visualstudio.xml)) -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/paket.references: -------------------------------------------------------------------------------- 1 | Gauge.CSharp.Core 2 | Gauge.CSharp.Lib 3 | Google.Protobuf 4 | VSSDK.DTE 5 | VSSDK.GraphModel 6 | VSSDK.IDE 7 | VSSDK.IDE.10 8 | VSSDK.IDE.11 9 | VSSDK.IDE.12 10 | VSSDK.IDE.8 11 | VSSDK.IDE.9 12 | VSSDK.OLE.Interop 13 | VSSDK.Shell.12 14 | VSSDK.Shell.Immutable.10 15 | VSSDK.Shell.Immutable.11 16 | VSSDK.Shell.Immutable.12 17 | VSSDK.Shell.Interop 18 | VSSDK.Shell.Interop.8 19 | VSSDK.Shell.Interop.9 20 | VSSDK.TextManager.Interop 21 | VSSDK.TextManager.Interop.8 22 | VSSDK.Threading 23 | VSSDK.Threading.12 24 | Microsoft.Net.Compilers -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repoName=gauge-visualstudio 4 | githubUser=getgauge 5 | 6 | go get -v -u github.com/aktau/github-release 7 | 8 | version=$(cat version.txt) 9 | release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" $repoName $githubUser) 10 | 11 | $GOPATH/bin/github-release release -u $githubUser -r $repoName --draft -t "v$version" -d "$release_description" -n "$repoName $version" 12 | 13 | for i in `ls *.vsix`; do 14 | $GOPATH/bin/github-release -v upload -u $githubUser -r $repoName -t "v$version" -n $i -f $i 15 | if [ $? -ne 0 ];then 16 | exit 1 17 | fi 18 | done -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/paket.references: -------------------------------------------------------------------------------- 1 | Gauge.CSharp.Core 2 | Gauge.CSharp.Lib 3 | Google.Protobuf 4 | Microsoft.CSharp 5 | VSSDK.DTE 6 | VSSDK.GraphModel 7 | VSSDK.IDE 8 | VSSDK.IDE.10 9 | VSSDK.IDE.11 10 | VSSDK.IDE.12 11 | VSSDK.IDE.8 12 | VSSDK.IDE.9 13 | VSSDK.OLE.Interop 14 | VSSDK.Shell.12 15 | VSSDK.Shell.Immutable.10 16 | VSSDK.Shell.Immutable.11 17 | VSSDK.Shell.Immutable.12 18 | VSSDK.Shell.Interop 19 | VSSDK.Shell.Interop.8 20 | VSSDK.Shell.Interop.9 21 | VSSDK.TextManager.Interop 22 | VSSDK.TextManager.Interop.8 23 | VSSDK.Threading 24 | VSSDK.Threading.12 25 | EnvDTE80 26 | Microsoft.TestPlatform.objectmodel 27 | Microsoft.VisualStudio.TestWindow.Interfaces 28 | Microsoft.Net.Compilers -------------------------------------------------------------------------------- /Gauge.VisualStudio/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Tests/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model.Tests/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/Gauge.VisualStudio.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | -------------------------------------------------------------------------------- /Gauge.VisualStudio/template-report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Gauge.VisualStudio/paket.references: -------------------------------------------------------------------------------- 1 | Gauge.CSharp.Core 2 | Gauge.CSharp.Lib 3 | Google.Protobuf 4 | VSSDK.ComponentModelHost 5 | VSSDK.CoreUtility 6 | VSSDK.DTE 7 | VSSDK.Editor 8 | VSSDK.GraphModel 9 | VSSDK.IDE 10 | VSSDK.IDE.10 11 | VSSDK.IDE.11 12 | VSSDK.IDE.12 13 | VSSDK.IDE.8 14 | VSSDK.IDE.9 15 | VSSDK.Language 16 | VSSDK.OLE.Interop 17 | VSSDK.Shell.12 18 | VSSDK.Shell.Immutable.10 19 | VSSDK.Shell.Immutable.11 20 | VSSDK.Shell.Immutable.12 21 | VSSDK.Shell.Interop 22 | VSSDK.Shell.Interop.10 23 | VSSDK.Shell.Interop.11 24 | VSSDK.Shell.Interop.12 25 | VSSDK.Shell.Interop.8 26 | VSSDK.Shell.Interop.9 27 | VSSDK.Text 28 | VSSDK.TextManager.Interop 29 | VSSDK.TextManager.Interop.8 30 | VSSDK.Threading 31 | VSSDK.Threading.12 32 | VSSDK.VSLangProj 33 | EnvDTE80 34 | Microsoft.VSSDK.BuildTools 35 | Microsoft.Net.Compilers -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/IGaugeRunner.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Gauge.VisualStudio.TestAdapter 16 | { 17 | public interface IGaugeRunner 18 | { 19 | void Run(); 20 | void Cancel(); 21 | } 22 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/GaugeDisplayErrorLevel.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Gauge.VisualStudio.Core 16 | { 17 | public enum GaugeDisplayErrorLevel 18 | { 19 | Info, 20 | Warning, 21 | Error 22 | } 23 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/IGaugeTestRunSettingsService.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Gauge.VisualStudio.TestAdapter 16 | { 17 | public interface IGaugeTestRunSettingsService 18 | { 19 | GaugeTestRunSettings Settings { get; } 20 | void MapSettings(bool useExecutionAPI); 21 | } 22 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/GaugePlugin.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.Core 18 | { 19 | [DataContract] 20 | public class GaugePlugin 21 | { 22 | [DataMember] public string name; 23 | 24 | [DataMember] public string version; 25 | } 26 | } -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ### Expected behavior 12 | Tell us what should happen 13 | 14 | ### Actual behavior 15 | Tell us what happens instead 16 | 17 | ### Steps to reproduce 18 | 1. 19 | 2. 20 | 3. 21 | 22 | ### Version Information 23 | 24 | VisualStudio Version and Edition :- 25 | Gauge VisualStudio Plugin Version :- 26 | 27 | ``` 28 | Run gauge -v on your system and paste the results here. 29 | ``` 30 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/GaugeVersionInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.Core 18 | { 19 | [DataContract] 20 | public class GaugeVersionInfo 21 | { 22 | [DataMember] public GaugePlugin[] plugins; 23 | 24 | [DataMember] public string version; 25 | } 26 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Helpers/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.InteropServices; 16 | using Microsoft.VisualStudio.OLE.Interop; 17 | 18 | namespace Gauge.VisualStudio.Core.Helpers 19 | { 20 | internal static class NativeMethods 21 | { 22 | [DllImport("ole32.dll")] 23 | public static extern int CreateBindCtx(uint reserved, out IBindCtx ppbc); 24 | } 25 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/IStep.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using Microsoft.VisualStudio.Text; 17 | 18 | namespace Gauge.VisualStudio.Model 19 | { 20 | public interface IStep 21 | { 22 | ITextSnapshotLine ContainingLine { get; } 23 | string Text { get; } 24 | List Parameters { get; } 25 | bool HasInlineTable { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/TableInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.TestAdapter 18 | { 19 | [DataContract] 20 | public class TableInfo 21 | { 22 | [DataMember(Name = "text")] 23 | public string Text { get; set; } 24 | 25 | [DataMember(Name = "rowIndex")] 26 | public int Row { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /version_nightly.ps1: -------------------------------------------------------------------------------- 1 | # Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | param([string]$nightly='') 16 | 17 | if ($nightly -eq "") { 18 | return 19 | } 20 | 21 | Write-Host "Adding $nightly to Gauge.VisualStudio DisplayName" 22 | $manifestPath = Resolve-Path(".\Gauge.VisualStudio\source.extension.vsixmanifest") 23 | $xmlContent = [xml](Get-Content($manifestPath)) 24 | 25 | $xmlContent.PackageManifest.Metadata.DisplayName += " [$nightly]" 26 | 27 | $xmlContent.Save($manifestPath) -------------------------------------------------------------------------------- /Gauge.VisualStudio/Loggers/StatusBarLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Loggers 18 | { 19 | internal class StatusBarLogger 20 | { 21 | internal static void Log(string message) 22 | { 23 | var statusBar = GaugePackage.DTE.StatusBar; 24 | statusBar.Text = message; 25 | statusBar.Highlight(true); 26 | Console.WriteLine(message); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Helpers/GaugeProjectProperties.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Core.Helpers 18 | { 19 | [Serializable] 20 | public class GaugeProjectProperties 21 | { 22 | public int ApiPort { get; set; } 23 | 24 | public int DaemonProcessId { get; set; } 25 | 26 | public string BuildOutputPath { get; set; } 27 | 28 | public string ProjectRoot { get; set; } 29 | 30 | public bool UseExecutionAPI { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Exceptions/GaugeVersionNotFoundException.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Core.Exceptions 18 | { 19 | [Serializable] 20 | public class GaugeVersionNotFoundException : GaugeExceptionBase 21 | { 22 | public GaugeVersionNotFoundException(string error) 23 | : base("Unable to read Gauge version") 24 | { 25 | Data.Add("GaugeError", error); 26 | } 27 | 28 | protected override string ErrorCode => "GAUGE-VS-003"; 29 | } 30 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Exceptions/GaugeVersionIncompatibleException.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Core.Exceptions 18 | { 19 | [Serializable] 20 | public class GaugeVersionIncompatibleException : GaugeExceptionBase 21 | { 22 | public GaugeVersionIncompatibleException(string error) 23 | : base($"Incompatible Gauge Version installed. Minimum version of Gauge required:{GaugeService.MinGaugeVersion}") 24 | { 25 | Data.Add("GaugeError", error); 26 | } 27 | 28 | protected override string ErrorCode => "GAUGE-VS-002"; 29 | } 30 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/IGaugeProcess.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics; 17 | using System.IO; 18 | 19 | namespace Gauge.VisualStudio.Core 20 | { 21 | public interface IGaugeProcess 22 | { 23 | StreamReader StandardError { get; } 24 | int ExitCode { get; } 25 | StreamReader StandardOutput { get; } 26 | Process BaseProcess { get; } 27 | int Id { get; } 28 | bool Start(); 29 | void WaitForExit(); 30 | event EventHandler Exited; 31 | void Kill(); 32 | event DataReceivedEventHandler OutputDataReceived; 33 | void BeginOutputReadLine(); 34 | } 35 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Highlighting/IGaugeErrorTag.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.ObjectModel; 16 | using Microsoft.VisualStudio.Language.Intellisense; 17 | using Microsoft.VisualStudio.Text.Tagging; 18 | 19 | namespace Gauge.VisualStudio.Highlighting 20 | { 21 | internal abstract class AbstractGaugeErrorTag : SmartTag, IErrorTag 22 | { 23 | public AbstractGaugeErrorTag(ReadOnlyCollection actionSets) : base(SmartTagType.Ephemeral, 24 | actionSets) 25 | { 26 | } 27 | 28 | public string ErrorType { get; protected set; } 29 | public object ToolTipContent { get; protected set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/StepImplementation.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using EnvDTE; 16 | 17 | namespace Gauge.VisualStudio.Model 18 | { 19 | public class StepImplementation : Implementation 20 | { 21 | public StepImplementation(CodeFunction function, string stepText) 22 | { 23 | Function = function; 24 | StepText = stepText; 25 | StepValue = Parser.StepValueRegex.Replace(stepText, "{}"); 26 | } 27 | 28 | public CodeFunction Function { get; } 29 | 30 | public override void NavigateToImplementation(DTE dte) 31 | { 32 | Project.NavigateToFunction(Function); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Guids.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio 18 | { 19 | internal static class GuidList 20 | { 21 | public const string GuidGaugeVsPackagePkgString = "309aa1cd-4dc1-43e9-9d19-85b21abf2520"; 22 | public const string GuidGaugeVsPackageCmdSetString = "d09143fc-0d23-4d55-9fda-4d90e5da0c3f"; 23 | public const string GuidGaugeLanguageInfoString = "9CD86691-B655-4CA6-8437-46928AC7363F"; 24 | public const string GuidGaugeEditorFactorString = "9C342BFA-0307-48CD-AE27-5E5211004926"; 25 | 26 | public static readonly Guid GuidGaugeVsPackageCmdSet = new Guid(GuidGaugeVsPackageCmdSetString); 27 | } 28 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/IGaugeServiceClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using Gauge.CSharp.Core; 17 | using Gauge.Messages; 18 | 19 | namespace Gauge.VisualStudio.Model 20 | { 21 | public interface IGaugeServiceClient 22 | { 23 | string GetParsedStepValueFromInput(EnvDTE.Project project, string input); 24 | string GetFindRegex(EnvDTE.Project project, string input); 25 | IEnumerable GetAllStepsFromGauge(EnvDTE.Project project); 26 | ProtoStepValue GetStepValueFromInput(EnvDTE.Project project, string input); 27 | IEnumerable GetSpecsFromGauge(IGaugeApiConnection apiConnection); 28 | } 29 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is used by Code Analysis to maintain SuppressMessage 16 | // attributes that are applied to this project. Project-level 17 | // suppressions either have no target or are given a specific target 18 | // and scoped to a namespace, type, member, etc. 19 | // 20 | // To add a suppression to this file, right-click the message in the 21 | // Error List, point to "Suppress Message(s)", and click "In Project 22 | // Suppression File". You do not need to add suppressions to this 23 | // file manually. 24 | 25 | using System.Diagnostics.CodeAnalysis; 26 | 27 | [assembly: SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to Gauge 2 | 3 | Contributions to Gauge are welcome and appreciated. Please read this document to understand the process for contributing. 4 | 5 | ## Gauge Core v/s Plugins 6 | 7 | Gauge Core is a project that has features that would reflect across all Gauge use cases. These features are typically agnostic of the user's choice of implementation language. 8 | 9 | Plugins are meant to do something specific. These could be adding support for a new language, or have a new report etc. 10 | 11 | So, depending on where you see your contribution fit, please focus on the respective repository. 12 | 13 | ## Contribution process 14 | 15 | Please read about the Contribution Process [here](https://github.com/getgauge/gauge/blob/master/CONTRIBUTING.md), if you are happy please sign the [Contributor's License Agreement](https://gauge-bot.herokuapp.com/cla/). 16 | 17 | ## How can I contribute 18 | 19 | Contributions can be of many forms: 20 | 21 | - Open an issue, or participate in an existing one. 22 | - Write some code, and send us a pull request. 23 | - Enhance the documentation 24 | - Participate in design discussions on Google Groups 25 | 26 | If you need help in getting started with contribution, feel free to reach out on the [Google Groups](https://groups.google.com/forum/#!forum/getgauge) or [Gitter](https://gitter.im/getgauge/chat). 27 | -------------------------------------------------------------------------------- /Gauge.VisualStudio/Highlighting/UnimplementedStepTag.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.ObjectModel; 16 | using Microsoft.VisualStudio.Language.Intellisense; 17 | 18 | namespace Gauge.VisualStudio.Highlighting 19 | { 20 | internal class UnimplementedStepTag : AbstractGaugeErrorTag 21 | { 22 | public UnimplementedStepTag(ReadOnlyCollection actionSets) : base(actionSets) 23 | { 24 | ErrorType = "Unimplemented Step"; 25 | ToolTipContent = 26 | "Step is not implemented or does not have a public method implementation.\nUse 'Implement Step' option to generate a method, ensure that the implementation is public"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/IGaugeService.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using EnvDTE; 17 | using Gauge.CSharp.Core; 18 | using Gauge.VisualStudio.Core.Helpers; 19 | 20 | namespace Gauge.VisualStudio.Core 21 | { 22 | public interface IGaugeService 23 | { 24 | IEnumerable GetAllApiConnections(); 25 | IGaugeApiConnection GetApiConnectionFor(Project project); 26 | void KillChildProcess(string slugifiedName); 27 | bool ContainsApiConnectionFor(string slugifiedName); 28 | List GetPropertiesForAllGaugeProjects(); 29 | void RegisterGaugeProject(Project project, int minPortRange, int maxPortRange); 30 | } 31 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Implementation.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using EnvDTE; 17 | 18 | namespace Gauge.VisualStudio.Model 19 | { 20 | public abstract class Implementation 21 | { 22 | public string StepText; 23 | public string StepValue; 24 | 25 | internal bool ContainsImplememntationFor(EnvDTE.Project project, string givenText) 26 | { 27 | try 28 | { 29 | return string.Compare(StepText, givenText, StringComparison.Ordinal) == 0; 30 | } 31 | catch 32 | { 33 | return false; 34 | } 35 | } 36 | 37 | public abstract void NavigateToImplementation(DTE dte); 38 | } 39 | } -------------------------------------------------------------------------------- /test.ps1: -------------------------------------------------------------------------------- 1 | # Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | if(!(Test-Path ".\artifacts")) 16 | { 17 | Write-Host "No project artifacts found, invoking build" 18 | & ".\build.ps1" 19 | } 20 | 21 | $nunit = "$($pwd)\packages\test\NUnit.Console\tools\nunit3-console.exe" 22 | 23 | if(!(Test-Path $nunit)) 24 | { 25 | throw "Nunit runner not found in $pwd" 26 | } 27 | &$nunit "$($pwd)\artifacts\Gauge.VisualStudio.Tests.dll" "$($pwd)\artifacts\Gauge.VisualStudio.Model.Tests.dll" "$($pwd)\artifacts\Gauge.VisualStudio.Core.Tests.dll" --result:"$($pwd)\artifacts\gauge.visualstudio.xml" 28 | 29 | # Hack to break on exit code. Powershell does not seem to propogate the exit code from test failures. 30 | if($LastExitCode -ne 0) 31 | { 32 | throw "Test execution failed." 33 | } 34 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Exceptions/GaugeAPIInitializationException.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Core.Exceptions 18 | { 19 | [Serializable] 20 | public sealed class GaugeApiInitializationException : GaugeExceptionBase 21 | { 22 | private const string ErrorMessage = "Failed to initialize Gauge API."; 23 | 24 | public GaugeApiInitializationException(string stdout, string stderr) : base(ErrorMessage) 25 | { 26 | Data.Add("STDOUT", stdout); 27 | Data.Add("STDERR", stderr); 28 | } 29 | 30 | public GaugeApiInitializationException() : base(ErrorMessage) 31 | { 32 | } 33 | 34 | protected override string ErrorCode => "GAUGE-VS-001"; 35 | } 36 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/UI/Theme/Generic.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 31 | 32 | -------------------------------------------------------------------------------- /paket.dependencies: -------------------------------------------------------------------------------- 1 | framework: net46 2 | 3 | source https://www.nuget.org/api/v2/ 4 | 5 | nuget NuGet.CommandLine 6 | nuget Gauge.CSharp.Core framework: >= net45 7 | nuget Gauge.CSharp.Lib framework: >= net45 8 | nuget Google.Protobuf framework: >= net45 9 | nuget Microsoft.CSharp 4.0.0 10 | nuget VSSDK.ComponentModelHost 12.0.4 framework: >= net45 11 | nuget VSSDK.CoreUtility 12.0.4 12 | nuget VSSDK.CoreUtility.12 12.0.4 framework: >= net45 13 | nuget VSSDK.Editor 12.0.4 framework: >= net45 14 | nuget VSSDK.GraphModel 12.0.4 15 | nuget VSSDK.IDE.12 12.0.4 16 | nuget VSSDK.Language 12.0.4 framework: >= net45 17 | nuget VSSDK.OLE.Interop 7.0.4 18 | nuget VSSDK.Shell.12 12.0.4 19 | nuget VSSDK.Shell.Interop.12 12.0.4 framework: >= net45 20 | nuget VSSDK.Text 12.0.4 21 | nuget VSSDK.Text.12 12.0.4 framework: >= net45 22 | nuget VSSDK.TextManager.Interop 7.0.4 23 | nuget VSSDK.TextManager.Interop.8 8.0.4 24 | nuget VSSDK.Threading 12.0.4 25 | nuget VSSDK.Threading.12 12.0.4 26 | nuget VSSDK.VSLangProj 7.0.4 framework: >= net45 27 | nuget EnvDTE80 8.0.0 28 | nuget Microsoft.VSSDK.BuildTools 29 | nuget Microsoft.TestPlatform.objectmodel 11.0.0 30 | nuget Microsoft.VisualStudio.TestWindow.Interfaces 11.0.61030 31 | nuget Microsoft.Net.Compilers 32 | 33 | group Test 34 | framework: net46 35 | source https://www.nuget.org/api/v2/ 36 | 37 | nuget FakeItEasy framework: >= net45 38 | nuget NUnit 3.0.1 framework: >= net45 39 | nuget NUnit.Runners 3.0.1 framework: >= net45 -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Extensions/TextSnapshotExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Linq; 16 | using EnvDTE; 17 | using Microsoft.VisualStudio.Text; 18 | 19 | namespace Gauge.VisualStudio.Model.Extensions 20 | { 21 | public static class TextSnapshotExtensions 22 | { 23 | public static EnvDTE.Project GetProject(this ITextSnapshot snapshot, DTE dte) 24 | { 25 | ITextDocument textDoc; 26 | if(!snapshot.TextBuffer.Properties.TryGetProperty(typeof(ITextDocument), out textDoc)) 27 | return null; 28 | var document = dte.Documents.Cast() 29 | .FirstOrDefault(d => string.CompareOrdinal(d.FullName, textDoc.FilePath) == 0); 30 | return document == null ? null : document.ProjectItem.ContainingProject; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Classification/ClassifierProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel.Composition; 16 | using Microsoft.VisualStudio.Text; 17 | using Microsoft.VisualStudio.Text.Classification; 18 | using Microsoft.VisualStudio.Utilities; 19 | 20 | namespace Gauge.VisualStudio.Classification 21 | { 22 | [Export(typeof(IClassifierProvider))] 23 | [ContentType(GaugeContentTypeDefinitions.GaugeContentType)] 24 | internal class ClassifierProvider : IClassifierProvider 25 | { 26 | [Import] private IClassificationTypeRegistryService _classificationRegistry; 27 | 28 | public IClassifier GetClassifier(ITextBuffer buffer) 29 | { 30 | return buffer.Properties.GetOrCreateSingletonProperty(() => 31 | new Classifier(buffer, _classificationRegistry)); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/IProject.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using EnvDTE; 17 | using Microsoft.VisualStudio.Text; 18 | using System; 19 | 20 | namespace Gauge.VisualStudio.Model 21 | { 22 | public interface IProject 23 | { 24 | void RefreshImplementations(); 25 | Implementation GetStepImplementation(ITextSnapshotLine line); 26 | IEnumerable GetFunctionsForClass(CodeClass codeClass); 27 | CodeClass FindOrCreateClass(string className); 28 | bool HasDuplicateImplementation(ITextSnapshotLine line); 29 | EnvDTE.Project VsProject { get; } 30 | IEnumerable> GetAllStepText(); 31 | IEnumerable GetAllClasses(EnvDTE.Project containingProject, 32 | bool includeReferencedProjects = true); 33 | } 34 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Highlighting/DuplicateStepImplementationTag.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using System.Collections.ObjectModel; 17 | using Microsoft.VisualStudio.Language.Intellisense; 18 | 19 | namespace Gauge.VisualStudio.Highlighting 20 | { 21 | internal class DuplicateStepImplementationTag : AbstractGaugeErrorTag 22 | { 23 | public DuplicateStepImplementationTag() : this( 24 | new ReadOnlyCollection(new List())) 25 | { 26 | } 27 | 28 | public DuplicateStepImplementationTag(ReadOnlyCollection actionSets) : base(actionSets) 29 | { 30 | ErrorType = "Duplicate Step Implementation"; 31 | ToolTipContent = "Multiple step implementations found. Gauge will skip execution of this scenario."; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/ConceptImplementation.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using EnvDTE; 16 | 17 | namespace Gauge.VisualStudio.Model 18 | { 19 | internal class ConceptImplementation : Implementation 20 | { 21 | private readonly Concept _concept; 22 | 23 | public ConceptImplementation(Concept concept) 24 | { 25 | _concept = concept; 26 | StepText = _concept.StepText; 27 | StepValue = _concept.StepValue; 28 | } 29 | 30 | public override void NavigateToImplementation(DTE dte) 31 | { 32 | var window = dte.ItemOperations.OpenFile(_concept.FilePath); 33 | window.Activate(); 34 | 35 | var textSelection = window.Selection as TextSelection; 36 | if (textSelection != null) 37 | textSelection.MoveTo(_concept.LineNumber, 0); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Gauge.VisualStudio.Tests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Gauge.VisualStudio.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("9f5b322c-211f-4b18-88f6-6d958a4d413c")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Exceptions/GaugeExceptionBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace Gauge.VisualStudio.Core.Exceptions 18 | { 19 | [Serializable] 20 | public abstract class GaugeExceptionBase : Exception 21 | { 22 | protected abstract string ErrorCode { get; } 23 | 24 | protected GaugeExceptionBase(string errorMessage) : base(errorMessage) 25 | { 26 | Data.Add("ErrorCode", ErrorCode); 27 | } 28 | 29 | public override string ToString() 30 | { 31 | var errorString = base.ToString(); 32 | foreach (var dataKey in Data.Keys) 33 | { 34 | errorString += $"{dataKey} : {Data[dataKey]}; "; 35 | } 36 | 37 | errorString += $"Refer https://info.getgauge.io/{ErrorCode} for more details."; 38 | return errorString; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/TestExecutionError.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.TestAdapter 18 | { 19 | [DataContract] 20 | public class TestExecutionError 21 | { 22 | [DataMember(Name = "text")] 23 | public string Text { get; set; } 24 | 25 | [DataMember(Name = "filename")] 26 | public string Filename { get; set; } 27 | 28 | [DataMember(Name = "message")] 29 | public string Message { get; set; } 30 | 31 | [DataMember(Name = "lineNo")] 32 | public string LineNo { get; set; } 33 | 34 | [DataMember(Name = "stackTrace")] 35 | public string StackTrace { get; set; } 36 | 37 | public override string ToString() 38 | { 39 | return $"{Text} => {Message}\n at {Filename}:{LineNo}\nStacktrace:\n{StackTrace}"; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Gauge.VisualStudio.Core.Tests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Gauge.VisualStudio.Core.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("417139ee-bdcc-44b8-ad6f-f990d2b9a6bf")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Gauge.VisualStudio.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("ThoughtWorks Inc.")] 11 | [assembly: AssemblyProduct("Gauge.VisualStudio.Core")] 12 | [assembly: AssemblyCopyright("2016 ThoughtWorks Inc")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("24c4951f-15a5-4c76-9a20-2e456a21500e")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("0.2.0.0")] 35 | [assembly: AssemblyFileVersion("0.2.0.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Gauge.VisualStudio.Model")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("ThoughtWorks Inc")] 11 | [assembly: AssemblyProduct("Gauge.VisualStudio.Model")] 12 | [assembly: AssemblyCopyright("2016 ThoughtWorks Inc")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("6990376b-fd73-4a61-a26c-3c2fc9429164")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("0.2.0.0")] 35 | [assembly: AssemblyFileVersion("0.2.0.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Gauge.VisualStudio.TestAdapter")] 8 | [assembly: AssemblyDescription("Visual Studio test runner for Gauge")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("ThoughtWorks Inc.")] 11 | [assembly: AssemblyProduct("Gauge.VisualStudio.TestAdapter")] 12 | [assembly: AssemblyCopyright("2016 ThoughtWorks Inc.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("62f2f1da-2357-4f63-991a-5449b3f31e00")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("0.2.0.0")] 35 | [assembly: AssemblyFileVersion("0.2.0.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Extensions/DocumentExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.IO; 16 | using System.Linq; 17 | using EnvDTE; 18 | 19 | namespace Gauge.VisualStudio.Core.Extensions 20 | { 21 | public static class DocumentExtensions 22 | { 23 | public static bool IsGaugeSpecFile(this Document document) 24 | { 25 | return document.FullName.IsGaugeSpecFile(); 26 | } 27 | 28 | public static bool IsGaugeConceptFile(this Document document) 29 | { 30 | return document.FullName.IsGaugeConceptFile(); 31 | } 32 | 33 | public static bool IsGaugeSpecFile(this string filePath) 34 | { 35 | return File.Exists(filePath) && new[] {".spec", ".md"}.Any(filePath.EndsWith); 36 | } 37 | 38 | public static bool IsGaugeConceptFile(this string filePath) 39 | { 40 | return File.Exists(filePath) && filePath.EndsWith(".cpt"); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/TestExecutionResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.TestAdapter 18 | { 19 | [DataContract] 20 | public class TestExecutionResult 21 | { 22 | [DataMember(Name = "status")] 23 | public string Status { get; set; } 24 | 25 | [DataMember(Name = "time")] 26 | public long Timestamp { get; set; } 27 | 28 | [DataMember(Name = "out")] 29 | public string Stdout { get; set; } 30 | 31 | [DataMember(Name = "errors")] 32 | public TestExecutionError[] Errors { get; set; } 33 | 34 | [DataMember(Name = "beforeHookFailure")] 35 | public TestExecutionError BeforeHookFailure { get; set; } 36 | 37 | [DataMember(Name = "afterHookFailure")] 38 | public TestExecutionError AfterHookFailure { get; set; } 39 | 40 | [DataMember(Name="table")] 41 | public TableInfo Table { get; set; } 42 | } 43 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GaugeClassifierProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.ComponentModel.Composition; 18 | using EnvDTE; 19 | using Microsoft.VisualStudio.Shell; 20 | using Microsoft.VisualStudio.Text; 21 | using Microsoft.VisualStudio.Text.Classification; 22 | using Microsoft.VisualStudio.Utilities; 23 | 24 | namespace Gauge.VisualStudio 25 | { 26 | [Export(typeof(IClassifierProvider))] 27 | [Order(Before = "default")] 28 | [ContentType(GaugeContentTypeDefinitions.GaugeContentType)] 29 | internal class GaugeClassifierProvider : IClassifierProvider 30 | { 31 | public static readonly Dictionary> ConceptDictionary = 32 | new Dictionary>(); 33 | 34 | [Import(typeof(SVsServiceProvider))] internal IServiceProvider ServiceProvider; 35 | 36 | public IClassifier GetClassifier(ITextBuffer buffer) 37 | { 38 | return null; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/TestExecutionEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.Serialization; 16 | 17 | namespace Gauge.VisualStudio.TestAdapter 18 | { 19 | [DataContract] 20 | public class TestExecutionEvent 21 | { 22 | [DataMember(Name = "type")] 23 | public string EventType { get; set; } 24 | 25 | [DataMember(Name="id")] 26 | public string Id { get; set; } 27 | 28 | [DataMember(Name = "parentId")] 29 | public string ParentId { get; set; } 30 | 31 | [DataMember(Name = "name")] 32 | public string Name { get; set; } 33 | 34 | [DataMember(Name = "filename")] 35 | public string Filename { get; set; } 36 | 37 | [DataMember(Name = "line")] 38 | public int Line { get; set; } 39 | 40 | [DataMember(Name="stream")] 41 | public int Stream { get; set; } 42 | 43 | [DataMember(Name = "message")] 44 | public string Message { get; set; } 45 | 46 | [DataMember(Name = "result")] 47 | public TestExecutionResult Result { get; set; } 48 | } 49 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/UI/Refactor.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Windows; 16 | using System.Windows.Input; 17 | 18 | namespace Gauge.VisualStudio.UI 19 | { 20 | public partial class RefactorDialog 21 | { 22 | public RefactorDialog(string stepText) 23 | { 24 | InitializeComponent(); 25 | StepTextBox.Text = stepText; 26 | StepTextBox.Focus(); 27 | StepTextBox.SelectAll(); 28 | WindowStartupLocation = WindowStartupLocation.CenterScreen; 29 | } 30 | 31 | public string StepText { get; private set; } 32 | 33 | private void BtnOk_Click(object sender, RoutedEventArgs e) 34 | { 35 | StepText = StepTextBox.Text; 36 | DialogResult = true; 37 | } 38 | 39 | private void BtnCancel_Click(object sender, RoutedEventArgs e) 40 | { 41 | Close(); 42 | } 43 | 44 | private void RefactorDialog_OnKeyDown(object sender, KeyEventArgs e) 45 | { 46 | if (e.Key == Key.Escape) 47 | DialogResult = false; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Helpers/DTEHelperTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using Gauge.VisualStudio.Core.Helpers; 16 | using NUnit.Framework; 17 | 18 | namespace Gauge.VisualStudio.Core.Tests.Helpers 19 | { 20 | [TestFixture] 21 | public class DTEHelperTests 22 | { 23 | [Test] 24 | public void NonVisualStudioProcessNameShouldBeInvalid() 25 | { 26 | Assert.IsFalse(DTEHelper.IsVisualStudioProcessName("!Random.DTE.12.0:", default(int))); 27 | } 28 | 29 | [Test] 30 | public void NullValueShouldBeInvalidProcessName() 31 | { 32 | Assert.IsFalse(DTEHelper.IsVisualStudioProcessName(null, default(int))); 33 | } 34 | 35 | [Test] 36 | public void ProcessNameForVS2013ShouldBeValid() 37 | { 38 | Assert.True(DTEHelper.IsVisualStudioProcessName("!VisualStudio.DTE.12.0:1234", default(int))); 39 | } 40 | 41 | [Test] 42 | public void ProcessNameForVS2015ShouldBeValid() 43 | { 44 | Assert.True(DTEHelper.IsVisualStudioProcessName("!VisualStudio.DTE.14.0:1234", default(int))); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GaugeDaemonOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel; 16 | using Microsoft.VisualStudio.Shell; 17 | 18 | namespace Gauge.VisualStudio 19 | { 20 | public class GaugeDaemonOptions : DialogPage 21 | { 22 | private const int MinimumPort = 46337; 23 | private const int MaximumPort = 46997; 24 | 25 | public GaugeDaemonOptions() 26 | { 27 | MinPortRange = MinimumPort; 28 | MaxPortRange = MaximumPort; 29 | } 30 | 31 | [Category("API Options")] 32 | [DisplayName("Min Port Number")] 33 | [Description("Minimum Port range that Gauge-VisualStudio should use to communicate with Gauge's API")] 34 | public int MinPortRange { get; set; } 35 | 36 | [Category("API Options")] 37 | [DisplayName("Max Port Number")] 38 | [Description("Maximum Port range that Gauge-VisualStudio should use to communicate with Gauge's API")] 39 | public int MaxPortRange { get; set; } 40 | 41 | public override void ResetSettings() 42 | { 43 | MinPortRange = MinimumPort; 44 | MaxPortRange = MaximumPort; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/ProjectFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using Gauge.VisualStudio.Core.Extensions; 16 | using System.Collections.Generic; 17 | 18 | namespace Gauge.VisualStudio.Model 19 | { 20 | public class ProjectFactory 21 | { 22 | private static Dictionary projects = new Dictionary(); 23 | 24 | public static void Initialize(EnvDTE.Project vsProject) 25 | { 26 | if (projects.ContainsKey(vsProject.SlugifiedName())) 27 | return; 28 | projects.Add(vsProject.SlugifiedName(), new Project(() => vsProject)); 29 | } 30 | 31 | public static IProject Get(EnvDTE.Project vsProject) 32 | { 33 | return Get(vsProject.SlugifiedName()); 34 | } 35 | 36 | public static IProject Get(string slugifiedName) 37 | { 38 | IProject retval; 39 | projects.TryGetValue(slugifiedName, out retval); 40 | return retval; 41 | } 42 | 43 | public static void Delete(string slugifiedName) 44 | { 45 | if (projects.ContainsKey(slugifiedName)) 46 | projects.Remove(slugifiedName); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Exceptions/GaugeApiInitializationExceptionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using Gauge.VisualStudio.Core.Exceptions; 16 | using NUnit.Framework; 17 | 18 | namespace Gauge.VisualStudio.Core.Tests.Exceptions 19 | { 20 | [TestFixture] 21 | public class GaugeApiInitializationExceptionTests 22 | { 23 | private const string ErrorCode = "GAUGE-VS-001"; 24 | 25 | [Test] 26 | public void ShouldHaveErrorCode() 27 | { 28 | var ex = new GaugeApiInitializationException("", ""); 29 | 30 | Assert.AreEqual(ex.Data["ErrorCode"], ErrorCode); 31 | } 32 | 33 | [Test] 34 | public void ShouldHaveDataInString() 35 | { 36 | var ex = new GaugeApiInitializationException("", ""); 37 | 38 | Assert.That($"{ex}".Contains(ErrorCode), Is.True, $"Expected {ex} to contain {ErrorCode}"); 39 | } 40 | 41 | [Test] 42 | public void ShouldHaveReferenceUrlInString() 43 | { 44 | var refUrl = $"https://info.getgauge.io/{ErrorCode}"; 45 | 46 | var ex = new GaugeApiInitializationException("", ""); 47 | 48 | Assert.That($"{ex}".Contains(refUrl), Is.True, $"Expected {ex} to contain {refUrl}"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Gauge.VisualStudio/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Reflection; 17 | using System.Resources; 18 | using System.Runtime.InteropServices; 19 | 20 | // General Information about an assembly is controlled through the following 21 | // set of attributes. Change these attribute values to modify the information 22 | // associated with an assembly. 23 | [assembly: AssemblyTitle("Gauge.VisualStudio")] 24 | [assembly: AssemblyDescription("Visual Studio Extension for running Gauge Specs")] 25 | [assembly: AssemblyConfiguration("")] 26 | [assembly: AssemblyCompany("ThoughtWorks Inc.")] 27 | [assembly: AssemblyProduct("Gauge.VisualStudio")] 28 | [assembly: AssemblyCopyright("2015 ThoughtWorks Inc.")] 29 | [assembly: AssemblyTrademark("")] 30 | [assembly: AssemblyCulture("")] 31 | [assembly: ComVisible(false)] 32 | [assembly: CLSCompliant(false)] 33 | [assembly: NeutralResourcesLanguage("en-US")] 34 | 35 | // Version information for an assembly consists of the following four values: 36 | // 37 | // Major Version 38 | // Minor Version 39 | // Build Number 40 | // Revision 41 | // 42 | // You can specify all the values or you can default the Revision and Build Numbers 43 | // by using the '*' as shown below: 44 | 45 | [assembly: AssemblyVersion("0.0.7.0")] 46 | [assembly: AssemblyFileVersion("0.0.7.0")] -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Extensions/StringExtensionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using Gauge.VisualStudio.Core.Extensions; 16 | using NUnit.Framework; 17 | 18 | namespace Gauge.VisualStudio.Core.Tests.Extensions 19 | { 20 | [TestFixture] 21 | public class StringExtensionTests 22 | { 23 | [Test] 24 | public void ShouldConvertStringToLiteral() 25 | { 26 | const string s = "this is some step text"; 27 | var expected = string.Format("\"{0}\"", s); 28 | 29 | var literal = s.ToLiteral(); 30 | 31 | Assert.AreEqual(expected, literal); 32 | } 33 | 34 | [Test] 35 | public void ShouldConvertStringToMethodIdentifier() 36 | { 37 | const string s = "123 this is some step 456 :, . text "; 38 | const string expected = "ThisIsSomeStep456TextTable"; 39 | 40 | var literal = s.ToMethodIdentifier(); 41 | 42 | Assert.AreEqual(expected, literal); 43 | } 44 | 45 | [Test] 46 | public void ShouldConvertStringToVariableIdentifier() 47 | { 48 | const string s = "123 this is some step 456 :, . text
"; 49 | const string expected = "thisIsSomeStep456TextTable"; 50 | 51 | var literal = s.ToVariableIdentifier(); 52 | 53 | Assert.AreEqual(expected, literal); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GaugeContentTypeDefinitions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel.Composition; 16 | using Microsoft.VisualStudio.Text.Classification; 17 | using Microsoft.VisualStudio.Utilities; 18 | 19 | namespace Gauge.VisualStudio 20 | { 21 | internal sealed class GaugeContentTypeDefinitions 22 | { 23 | public const string GaugeContentType = "Gauge"; 24 | internal const string SpecFileExtension = ".spec"; 25 | internal const string MarkdownFileExtension = ".md"; 26 | internal const string ConceptFileExtension = ".cpt"; 27 | 28 | [Export] [Name(GaugeContentType)] [BaseDefinition("text")] 29 | internal static ContentTypeDefinition GaugeContentTypeDefinition; 30 | 31 | [Export(typeof(ClassificationTypeDefinition))] [Name(GaugeContentType)] [BaseDefinition("text")] 32 | internal static ClassificationTypeDefinition GaugeClassificationTypeDefinition; 33 | 34 | [Export] [ContentType(GaugeContentType)] 35 | internal static FileExtensionToContentTypeDefinition GaugeFileExtensionDefinition; 36 | 37 | [Export] [ContentType(GaugeContentType)] 38 | internal static FileExtensionToContentTypeDefinition GaugeMarkdownFileExtensionDefinition; 39 | 40 | [Export] [ContentType(GaugeContentType)] 41 | internal static FileExtensionToContentTypeDefinition GaugeConceptFileExtensionDefinition; 42 | } 43 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/GaugeTestRunSettings.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Xml; 18 | using System.Xml.Serialization; 19 | using Gauge.VisualStudio.Core; 20 | using Gauge.VisualStudio.Core.Helpers; 21 | using Microsoft.VisualStudio.TestPlatform.ObjectModel; 22 | 23 | namespace Gauge.VisualStudio.TestAdapter 24 | { 25 | public class GaugeTestRunSettings : TestRunSettings 26 | { 27 | public const string SettingsName = "GaugeTestRunSettings"; 28 | 29 | private static readonly XmlSerializer Serializer = new XmlSerializer(typeof(GaugeTestRunSettings)); 30 | 31 | public GaugeTestRunSettings(string name) : base(name) 32 | { 33 | ProjectsProperties = GaugeService.Instance.GetPropertiesForAllGaugeProjects(); 34 | } 35 | 36 | public GaugeTestRunSettings() : this(SettingsName) 37 | { 38 | } 39 | 40 | public bool UseExecutionAPI { get; set; } 41 | 42 | public List ProjectsProperties { get; } 43 | 44 | public override XmlElement ToXml() 45 | { 46 | var stringWriter = new StringWriter(); 47 | Serializer.Serialize(stringWriter, this); 48 | var document = new XmlDocument(); 49 | document.LoadXml(stringWriter.ToString()); 50 | return document.DocumentElement; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/UI/Refactor.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
"; 54 | Assert.AreEqual(expected, Step.GetStepText(_textSnapshotLines[0])); 55 | } 56 | } 57 | 58 | [Test] 59 | public void ShouldFetchStepTextForTableParam() 60 | { 61 | const string stepText = "Step that takes a table "; 62 | var snapshotLine = A.Fake(); 63 | A.CallTo(() => snapshotLine.LineNumber).Returns(1); 64 | A.CallTo(() => snapshotLine.GetText()).Returns(stepText); 65 | 66 | Step.GetStepText(snapshotLine); 67 | A.CallTo(() => snapshotLine.GetText()).MustHaveHappened(); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/UI/ClassPicker.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Windows; 19 | using System.Windows.Input; 20 | using System.Windows.Media; 21 | using Microsoft.CSharp; 22 | using Gauge.VisualStudio.Model; 23 | 24 | namespace Gauge.VisualStudio.UI 25 | { 26 | public partial class ClassPicker : IDisposable 27 | { 28 | private readonly SolidColorBrush _blackColor = new SolidColorBrush(Color.FromRgb(0, 0, 0)); 29 | private readonly IEnumerable _classNames; 30 | private readonly CSharpCodeProvider _cSharpCodeProvider = new CSharpCodeProvider(); 31 | private readonly SolidColorBrush _redColor = new SolidColorBrush(Color.FromRgb(255, 0, 0)); 32 | private bool _disposed; 33 | 34 | public ClassPicker(EnvDTE.Project project) 35 | { 36 | InitializeComponent(); 37 | WindowStartupLocation = WindowStartupLocation.CenterScreen; 38 | _classNames = ProjectFactory.Get(project).GetAllClasses(project, false).Select(element => element.Name).Take(10); 39 | ClassListBox.ItemsSource = _classNames; 40 | } 41 | 42 | public string SelectedClass { get; private set; } 43 | 44 | public void Dispose() 45 | { 46 | Dispose(true); 47 | GC.SuppressFinalize(this); 48 | } 49 | 50 | private void ClassPicker_OnKeyDown(object sender, KeyEventArgs e) 51 | { 52 | switch (e.Key) 53 | { 54 | case Key.Escape: 55 | Close(); 56 | break; 57 | case Key.Enter: 58 | if (IsValidIdentifier()) 59 | { 60 | SelectedClass = ClassListBox.Text; 61 | Close(); 62 | } 63 | break; 64 | } 65 | ClassListBox.Foreground = IsValidIdentifier() ? _blackColor : _redColor; 66 | } 67 | 68 | private bool IsValidIdentifier() 69 | { 70 | return _cSharpCodeProvider.IsValidIdentifier(ClassListBox.Text); 71 | } 72 | 73 | protected virtual void Dispose(bool disposing) 74 | { 75 | if (_disposed) 76 | return; 77 | 78 | if (disposing) 79 | _cSharpCodeProvider.Dispose(); 80 | 81 | _disposed = true; 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Format/FormatCommandFilter.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | using Gauge.VisualStudio.Core; 18 | using Gauge.VisualStudio.Core.Loggers; 19 | using Microsoft.VisualStudio; 20 | using Microsoft.VisualStudio.OLE.Interop; 21 | using Microsoft.VisualStudio.Shell; 22 | using Microsoft.VisualStudio.Text.Editor; 23 | 24 | namespace Gauge.VisualStudio.Format 25 | { 26 | internal class FormatCommandFilter : IOleCommandTarget 27 | { 28 | private readonly SVsServiceProvider _serviceProvider; 29 | 30 | public FormatCommandFilter(IWpfTextView textView, SVsServiceProvider serviceProvider) 31 | { 32 | _serviceProvider = serviceProvider; 33 | TextView = textView; 34 | } 35 | 36 | private IWpfTextView TextView { get; } 37 | public IOleCommandTarget Next { get; set; } 38 | 39 | public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) 40 | { 41 | ThreadHelper.ThrowIfNotOnUIThread(); 42 | if ((VSConstants.VSStd2KCmdID)prgCmds[0].cmdID != VSConstants.VSStd2KCmdID.FORMATDOCUMENT) 43 | return Next.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); 44 | 45 | prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_ENABLED | (uint)OLECMDF.OLECMDF_SUPPORTED; 46 | return VSConstants.S_OK; 47 | } 48 | 49 | public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 50 | { 51 | ThreadHelper.ThrowIfNotOnUIThread(); 52 | if (VsShellUtilities.IsInAutomationFunction(_serviceProvider)) 53 | return Next.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 54 | 55 | if ((VSConstants.VSStd2KCmdID)nCmdID != VSConstants.VSStd2KCmdID.FORMATDOCUMENT) 56 | { 57 | return Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 58 | } 59 | 60 | var gaugeFile = new FileInfo(GaugePackage.DTE.ActiveDocument.FullName); 61 | 62 | var p = GaugeProcess.ForFormat(gaugeFile.DirectoryName, gaugeFile.Name); 63 | p.Start(); 64 | p.WaitForExit(); 65 | if (p.ExitCode != 0) 66 | { 67 | OutputPaneLogger.Error($"gauge format {gaugeFile.Name}\nSTDOUT:\n{p.StandardOutput.ReadToEnd()}\nSTDERR:\n{p.StandardError.ReadToEnd()}\n"); 68 | } 69 | return VSConstants.S_OK; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/TestContainerDiscoverer.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Concurrent; 17 | using System.Collections.Generic; 18 | using System.ComponentModel.Composition; 19 | using System.Threading.Tasks; 20 | using EnvDTE; 21 | using EnvDTE80; 22 | using Gauge.VisualStudio.Core.Extensions; 23 | using Gauge.VisualStudio.Model; 24 | using Microsoft.VisualStudio.Shell; 25 | using Microsoft.VisualStudio.TestWindow.Extensibility; 26 | 27 | namespace Gauge.VisualStudio.TestAdapter 28 | { 29 | [Export(typeof(ITestContainerDiscoverer))] 30 | public class TestContainerDiscoverer : ITestContainerDiscoverer 31 | { 32 | private readonly ProjectItemsEvents _projectItemsEvents; 33 | private readonly IServiceProvider _serviceProvider; 34 | 35 | [ImportingConstructor] 36 | public TestContainerDiscoverer([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) 37 | { 38 | _serviceProvider = serviceProvider; 39 | var dte = _serviceProvider.GetService(typeof(DTE)) as DTE; 40 | var events2 = (Events2) dte.Events; 41 | _projectItemsEvents = events2.ProjectItemsEvents; 42 | 43 | _projectItemsEvents.ItemAdded += UpdateTestContainersIfGaugeSpecFile; 44 | _projectItemsEvents.ItemRemoved += UpdateTestContainersIfGaugeSpecFile; 45 | _projectItemsEvents.ItemRenamed += (item, s) => UpdateTestContainersIfGaugeSpecFile(item); 46 | } 47 | 48 | public Uri ExecutorUri => TestExecutor.ExecutorUri; 49 | 50 | public IEnumerable TestContainers => GetTestContainers(); 51 | 52 | public event EventHandler TestContainersUpdated; 53 | 54 | private IEnumerable GetTestContainers() 55 | { 56 | var testContainers = new ConcurrentBag(); 57 | var specs = Specification.GetAllSpecsFromGauge(); 58 | Parallel.ForEach(specs, s => 59 | { 60 | testContainers.Add(new TestContainer(this, s, DateTime.Now)); 61 | }); 62 | return testContainers; 63 | } 64 | 65 | private void UpdateTestContainersIfGaugeSpecFile(ProjectItem projectItem) 66 | { 67 | if (projectItem?.ContainingProject == null) 68 | return; 69 | if (projectItem.ContainingProject.IsGaugeProject() 70 | && projectItem.FileNames[0].IsGaugeSpecFile()) 71 | TestContainersUpdated?.Invoke(this, EventArgs.Empty); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core/Extensions/ProjectExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | using System.Text.RegularExpressions; 18 | using EnvDTE; 19 | using Microsoft.VisualStudio; 20 | using Microsoft.VisualStudio.Shell.Interop; 21 | 22 | namespace Gauge.VisualStudio.Core.Extensions 23 | { 24 | public static class ProjectExtensions 25 | { 26 | private static readonly Regex ManifestExists = new Regex("\"Language\"\\s*:\\s*\"csharp\"", 27 | RegexOptions.Compiled | RegexOptions.Compiled | RegexOptions.IgnoreCase); 28 | 29 | public static string SlugifiedName(this Project project) 30 | { 31 | return project == null ? "" : project.Name.Replace('.', '_'); 32 | } 33 | 34 | public static bool IsGaugeProject(this Project project) 35 | { 36 | try 37 | { 38 | var directoryName = Path.GetDirectoryName(project.FileName); 39 | var manifestPath = Path.Combine(directoryName, "manifest.json"); 40 | if (!File.Exists(manifestPath)) 41 | return false; 42 | 43 | var manifest = File.ReadAllText(manifestPath); 44 | return ManifestExists.IsMatch(manifest); 45 | } 46 | catch 47 | { 48 | return false; 49 | } 50 | } 51 | 52 | public static Project ToProject(this IVsHierarchy hierarchy) 53 | { 54 | object objProj; 55 | hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int) __VSHPROPID.VSHPROPID_ExtObject, out objProj); 56 | 57 | return objProj as Project; 58 | } 59 | 60 | public static string GetProjectOutputPath(this Project project) 61 | { 62 | var configurationManager = project.ConfigurationManager; 63 | try 64 | { 65 | var activeConfiguration = configurationManager.ActiveConfiguration; 66 | var outputPath = activeConfiguration.Properties.Item("OutputPath").Value.ToString(); 67 | return Path.IsPathRooted(outputPath) 68 | ? outputPath 69 | : Path.GetFullPath(Path.Combine(Path.GetDirectoryName(project.FullName), outputPath)); 70 | } 71 | catch 72 | { 73 | // cant read ActiveConfiguration for some reason 74 | // happens at least when creating a new project via templates. 75 | return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(project.FullName), "bin", "Debug")); 76 | } 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Autocomplete/CompletionSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.ComponentModel.Composition; 18 | using Gauge.VisualStudio.Model; 19 | using Gauge.VisualStudio.Model.Extensions; 20 | using Microsoft.VisualStudio.Language.Intellisense; 21 | using Microsoft.VisualStudio.Text; 22 | using Microsoft.VisualStudio.Text.Operations; 23 | using Microsoft.VisualStudio.Utilities; 24 | 25 | namespace Gauge.VisualStudio.AutoComplete 26 | { 27 | public class CompletionSource 28 | { 29 | [Export(typeof(ICompletionSourceProvider))] 30 | [ContentType(GaugeContentTypeDefinitions.GaugeContentType)] 31 | [Name("gaugeCompletion")] 32 | private class GaugeCompletionSourceProvider : ICompletionSourceProvider 33 | { 34 | [Import] 35 | internal ITextStructureNavigatorSelectorService NavigatorService { get; set; } 36 | 37 | public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer) 38 | { 39 | try 40 | { 41 | return new GaugeCompletionSource(textBuffer); 42 | } 43 | catch 44 | { 45 | return null; 46 | } 47 | } 48 | } 49 | 50 | private class GaugeCompletionSource : ICompletionSource 51 | { 52 | private readonly ITextBuffer _buffer; 53 | private bool _disposed; 54 | private readonly IProject _project; 55 | 56 | public GaugeCompletionSource(ITextBuffer buffer) 57 | { 58 | var vsProject = buffer.CurrentSnapshot.GetProject(GaugePackage.DTE); 59 | var vsProjectFunc = new Func(() => vsProject); 60 | _project = ProjectFactory.Get(vsProject); 61 | _buffer = buffer; 62 | } 63 | 64 | public void AugmentCompletionSession(ICompletionSession session, IList completionSets) 65 | { 66 | if (_disposed) 67 | throw new ObjectDisposedException("GaugeCompletionSource"); 68 | 69 | var snapshot = _buffer.CurrentSnapshot; 70 | var snapshotPoint = session.GetTriggerPoint(snapshot); 71 | if (!snapshotPoint.HasValue) return; 72 | completionSets.Add(new GaugeCompletionSet(snapshotPoint.Value, _project)); 73 | } 74 | 75 | public void Dispose() 76 | { 77 | if (_disposed) return; 78 | 79 | GC.SuppressFinalize(this); 80 | _disposed = true; 81 | } 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/CommandController.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel.Composition; 16 | using Gauge.VisualStudio.AutoComplete; 17 | using Gauge.VisualStudio.Format; 18 | using Gauge.VisualStudio.GotoDefn; 19 | using Gauge.VisualStudio.Refactor; 20 | using Gauge.VisualStudio.References; 21 | using Microsoft.VisualStudio.Editor; 22 | using Microsoft.VisualStudio.Language.Intellisense; 23 | using Microsoft.VisualStudio.OLE.Interop; 24 | using Microsoft.VisualStudio.Shell; 25 | using Microsoft.VisualStudio.Text.Editor; 26 | using Microsoft.VisualStudio.TextManager.Interop; 27 | using Microsoft.VisualStudio.Utilities; 28 | 29 | namespace Gauge.VisualStudio 30 | { 31 | public class CommandController 32 | { 33 | [Export(typeof(IVsTextViewCreationListener))] 34 | [ContentType(GaugeContentTypeDefinitions.GaugeContentType)] 35 | [TextViewRole(PredefinedTextViewRoles.Document)] 36 | internal sealed class VsTextViewCreationListener : IVsTextViewCreationListener 37 | { 38 | [Import] private IVsEditorAdaptersFactoryService _adaptersFactory; 39 | 40 | [Import] private ICompletionBroker _completionBroker; 41 | 42 | [Import] 43 | internal SVsServiceProvider ServiceProvider { get; set; } 44 | 45 | public void VsTextViewCreated(IVsTextView textViewAdapter) 46 | { 47 | var view = _adaptersFactory.GetWpfTextView(textViewAdapter); 48 | 49 | var autoCompleteCommandFilter = new AutoCompleteCommandFilter(view, _completionBroker, ServiceProvider); 50 | 51 | IOleCommandTarget next; 52 | textViewAdapter.AddCommandFilter(autoCompleteCommandFilter, out next); 53 | autoCompleteCommandFilter.Next = next; 54 | 55 | var gotoDefnCommandFilter = new GotoDefnCommandFilter(view, ServiceProvider); 56 | textViewAdapter.AddCommandFilter(gotoDefnCommandFilter, out next); 57 | gotoDefnCommandFilter.Next = next; 58 | 59 | var refactorCommandFilter = new RenameCommandFilter(view, ServiceProvider); 60 | textViewAdapter.AddCommandFilter(refactorCommandFilter, out next); 61 | refactorCommandFilter.Next = next; 62 | 63 | var findReferencesCommandFilter = new FindReferencesCommandFilter(view, ServiceProvider); 64 | textViewAdapter.AddCommandFilter(findReferencesCommandFilter, out next); 65 | findReferencesCommandFilter.Next = next; 66 | 67 | var formatCommandFilter = new FormatCommandFilter(view, ServiceProvider); 68 | textViewAdapter.AddCommandFilter(formatCommandFilter, out next); 69 | formatCommandFilter.Next = next; 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.TestAdapter/GaugeTestRunSettingsService.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel.Composition; 16 | using System.IO; 17 | using System.Xml; 18 | using System.Xml.Serialization; 19 | using System.Xml.XPath; 20 | using Microsoft.VisualStudio.TestPlatform.ObjectModel; 21 | using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; 22 | using Microsoft.VisualStudio.TestWindow.Extensibility; 23 | 24 | namespace Gauge.VisualStudio.TestAdapter 25 | { 26 | [Export(typeof(ISettingsProvider))] 27 | [Export(typeof(IRunSettingsService))] 28 | [Export(typeof(IGaugeTestRunSettingsService))] 29 | [SettingsName(GaugeTestRunSettings.SettingsName)] 30 | public class GaugeTestRunSettingsService : IRunSettingsService, ISettingsProvider, IGaugeTestRunSettingsService 31 | { 32 | public GaugeTestRunSettingsService() 33 | { 34 | Name = GaugeTestRunSettings.SettingsName; 35 | Settings = new GaugeTestRunSettings(); 36 | Serializer = new XmlSerializer(typeof(GaugeTestRunSettings)); 37 | } 38 | 39 | public XmlSerializer Serializer { get; } 40 | 41 | public void MapSettings(bool useExecutionAPI) 42 | { 43 | Settings.UseExecutionAPI = useExecutionAPI; 44 | } 45 | 46 | public GaugeTestRunSettings Settings { get; private set; } 47 | 48 | public IXPathNavigable AddRunSettings(IXPathNavigable inputRunSettingDocument, 49 | IRunSettingsConfigurationInfo configurationInfo, 50 | ILogger log) 51 | { 52 | ValidateArg.NotNull(inputRunSettingDocument, "inputRunSettingDocument"); 53 | ValidateArg.NotNull(configurationInfo, "configurationInfo"); 54 | 55 | var navigator = inputRunSettingDocument.CreateNavigator(); 56 | 57 | if (navigator.MoveToChild("RunSettings", "")) 58 | { 59 | if (navigator.MoveToChild(GaugeTestRunSettings.SettingsName, "")) 60 | navigator.DeleteSelf(); 61 | 62 | navigator.AppendChild(SerializeGaugeSettings()); 63 | } 64 | 65 | navigator.MoveToRoot(); 66 | return navigator; 67 | } 68 | 69 | public string Name { get; } 70 | 71 | public void Load(XmlReader reader) 72 | { 73 | ValidateArg.NotNull(reader, "reader"); 74 | 75 | if (reader.Read() && reader.Name.Equals(GaugeTestRunSettings.SettingsName)) 76 | Settings = Serializer.Deserialize(reader) as GaugeTestRunSettings; 77 | } 78 | 79 | private string SerializeGaugeSettings() 80 | { 81 | var stringWriter = new StringWriter(); 82 | Serializer.Serialize(stringWriter, new GaugeTestRunSettings {UseExecutionAPI = Settings.UseExecutionAPI}); 83 | return stringWriter.ToString(); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Concept.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using Gauge.Messages; 19 | using Gauge.VisualStudio.Core; 20 | using Gauge.VisualStudio.Core.Loggers; 21 | 22 | namespace Gauge.VisualStudio.Model 23 | { 24 | public class Concept 25 | { 26 | private readonly EnvDTE.Project _project; 27 | 28 | public Concept(EnvDTE.Project project) 29 | { 30 | _project = project; 31 | } 32 | 33 | public string StepText { get; set; } 34 | public string StepValue { get; set; } 35 | public string FilePath { get; set; } 36 | public int LineNumber { get; set; } 37 | 38 | public IEnumerable GetAllConcepts() 39 | { 40 | if (_project == null) 41 | { 42 | OutputPaneLogger.Error("Error occurred GetAllConcepts: _project is null"); 43 | return Enumerable.Empty(); 44 | } 45 | var gaugeApiConnection = GaugeService.Instance.GetApiConnectionFor(_project); 46 | if (gaugeApiConnection == null) 47 | { 48 | OutputPaneLogger.Error("Error occurred GetAllConcepts: apiConnection is null"); 49 | return Enumerable.Empty(); 50 | } 51 | var conceptsRequest = new GetAllConceptsRequest(); 52 | var apiMessage = new APIMessage 53 | { 54 | MessageId = GenerateMessageId(), 55 | MessageType = APIMessage.Types.APIMessageType.GetAllConceptsRequest, 56 | AllConceptsRequest = conceptsRequest 57 | }; 58 | 59 | var bytes = gaugeApiConnection.WriteAndReadApiMessage(apiMessage); 60 | 61 | return bytes.AllConceptsResponse.Concepts.Select(info => new Concept(_project) 62 | { 63 | StepText = info.StepValue.ParameterizedStepValue, 64 | StepValue = info.StepValue.StepValue, 65 | FilePath = info.Filepath, 66 | LineNumber = info.LineNumber 67 | }); 68 | } 69 | 70 | private static long GenerateMessageId() 71 | { 72 | return DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; 73 | } 74 | 75 | public Concept Search(string lineText) 76 | { 77 | try 78 | { 79 | var gaugeServiceClient = new GaugeServiceClient(); 80 | return GetAllConcepts().FirstOrDefault( 81 | concept => string.CompareOrdinal( 82 | gaugeServiceClient.GetParsedStepValueFromInput(_project, concept.StepText), 83 | gaugeServiceClient.GetParsedStepValueFromInput(_project, lineText)) == 0); 84 | } 85 | catch 86 | { 87 | return null; 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at gauge-coc@thoughtworks.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /.paket/paket.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | true 8 | $(MSBuildThisFileDirectory) 9 | $(MSBuildThisFileDirectory)..\ 10 | /Library/Frameworks/Mono.framework/Commands/mono 11 | mono 12 | 13 | 14 | 15 | $(PaketRootPath)paket.exe 16 | $(PaketToolsPath)paket.exe 17 | $(PaketToolsPath)paket.bootstrapper.exe 18 | "$(PaketExePath)" 19 | $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" 20 | "$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs) 21 | $(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs) 22 | 23 | $(MSBuildProjectDirectory)\paket.references 24 | $(MSBuildStartupDirectory)\paket.references 25 | $(MSBuildProjectFullPath).paket.references 26 | $(PaketCommand) restore --references-files "$(PaketReferences)" 27 | $(PaketBootStrapperCommand) 28 | 29 | RestorePackages; $(BuildDependsOn); 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Gauge.VisualStudio/Highlighting/ImplementStepAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.ObjectModel; 17 | using System.Windows.Media; 18 | using System.Windows.Media.Imaging; 19 | using EnvDTE; 20 | using Gauge.VisualStudio.Model; 21 | using Gauge.VisualStudio.Model.Extensions; 22 | using Gauge.VisualStudio.UI; 23 | using Microsoft.VisualStudio.Language.Intellisense; 24 | using Microsoft.VisualStudio.Text; 25 | using Project = Gauge.VisualStudio.Model.Project; 26 | 27 | namespace Gauge.VisualStudio.Highlighting 28 | { 29 | internal class ImplementStepAction : ISmartTagAction 30 | { 31 | private readonly IProject _project; 32 | private readonly ITextSnapshot _snapshot; 33 | private readonly SnapshotSpan _span; 34 | private readonly StepImplementationGenerator _stepImplementationGenerator; 35 | private readonly ITrackingSpan _trackingSpan; 36 | private readonly UnimplementedStepTagger _unimplementedStepTagger; 37 | 38 | public ImplementStepAction(SnapshotSpan span, UnimplementedStepTagger unimplementedStepTagger, IProject project) 39 | { 40 | _trackingSpan = span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeInclusive); 41 | _span = span; 42 | _unimplementedStepTagger = unimplementedStepTagger; 43 | _snapshot = _trackingSpan.TextBuffer.CurrentSnapshot; 44 | DisplayText = "Implement Step"; 45 | Icon = new BitmapImage( 46 | new Uri("pack://application:,,,/Gauge.VisualStudio;component/assets/glyphs/step.png")); 47 | _project = project; 48 | var step = new Step(_project, span.Start.GetContainingLine()); 49 | _stepImplementationGenerator = new StepImplementationGenerator(project, step); 50 | } 51 | 52 | public void Invoke() 53 | { 54 | var classPicker = new ClassPicker(_snapshot.GetProject(GaugePackage.DTE)); 55 | var selectedClass = string.Empty; 56 | classPicker.ShowModal(); 57 | selectedClass = classPicker.SelectedClass; 58 | 59 | var containingLine = _trackingSpan.GetStartPoint(_snapshot).GetContainingLine(); 60 | if (_project.GetStepImplementation(containingLine) != null || selectedClass == null) 61 | return; 62 | 63 | CodeClass targetClass; 64 | CodeFunction implementationFunction; 65 | var gotImplementation = _stepImplementationGenerator.TryGenerateMethodStub(selectedClass, containingLine, 66 | out targetClass, 67 | out implementationFunction); 68 | 69 | if (!gotImplementation) return; 70 | 71 | _project.RefreshImplementations(); 72 | Project.NavigateToFunction(implementationFunction); 73 | _unimplementedStepTagger.MarkTagImplemented(_span); 74 | IsEnabled = false; 75 | } 76 | 77 | public ReadOnlyCollection ActionSets => null; 78 | 79 | public ImageSource Icon { get; } 80 | 81 | public string DisplayText { get; } 82 | 83 | public bool IsEnabled { get; private set; } = true; 84 | } 85 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/GaugeVersionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using NUnit.Framework; 17 | 18 | namespace Gauge.VisualStudio.Core.Tests 19 | { 20 | [TestFixture] 21 | public class GaugeVersionTests 22 | { 23 | [Test] 24 | [TestCase("0.1.2", "0.1.5", -1)] 25 | [TestCase("0.1.2", "0.0.8", 1)] 26 | [TestCase("0.1.2", "0.1.2", 0)] 27 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.2.nightly-2015-11-10", 0)] 28 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.2.nightly-2014-11-10", 1)] 29 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.1.nightly-2014-11-10", 1)] 30 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.1.nightly-2015-11-10", 1)] 31 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.3.nightly-2014-11-10", -1)] 32 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.2.nightly-2015-12-10", -1)] 33 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.3.nightly-2015-12-10", -1)] 34 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.1", 1)] 35 | [TestCase("0.1.2.nightly-2015-11-10", "0.1.3", -1)] 36 | public void ShouldCompareTwoGaugeVersions(string v1, string v2, int expected) 37 | { 38 | var actual = new GaugeVersion(v1).CompareTo(new GaugeVersion(v2)); 39 | 40 | Assert.AreEqual(expected, actual); 41 | } 42 | 43 | [Test] 44 | public void ShouldCreateVersionFromString() 45 | { 46 | var gaugeVersion = new GaugeVersion("0.1.2"); 47 | 48 | Assert.AreEqual(0, gaugeVersion.Major); 49 | Assert.AreEqual(1, gaugeVersion.Minor); 50 | Assert.AreEqual(2, gaugeVersion.Patch); 51 | } 52 | 53 | [Test] 54 | [TestCase("0.1.2")] 55 | [TestCase("0.1.2.nightly-2016-12-06")] 56 | public void ShouldGetToString(string version) 57 | { 58 | var actual = new GaugeVersion(version).ToString(); 59 | 60 | Assert.AreEqual(version, actual); 61 | } 62 | 63 | [Test] 64 | [TestCase("0.1.2.nightly-2016-12-06", true)] 65 | [TestCase("0.1.2", false)] 66 | public void ShouldParseNightly(string version, bool expectedNightly) 67 | { 68 | var isNightly = new GaugeVersion(version).IsNightly; 69 | 70 | Assert.AreEqual(expectedNightly, isNightly); 71 | } 72 | 73 | [Test] 74 | [TestCase("0.1.2.nightly-2016-12-06", "2016-12-06")] 75 | [TestCase("0.1.2", "0001-01-01")] 76 | public void ShouldParseNightlyDate(string version, string expectedDate) 77 | { 78 | var date = new GaugeVersion(version).Date.ToString("yyyy-MM-dd"); 79 | 80 | Assert.AreEqual(expectedDate, date); 81 | } 82 | 83 | [Test] 84 | [TestCase("random_string")] 85 | [TestCase("123")] 86 | [TestCase("0..2")] 87 | [TestCase("-121")] 88 | public void ShouldThrowArgumentExceptionForInvalidString(string version) 89 | { 90 | var argumentException = Assert.Throws(() => new GaugeVersion(version)); 91 | 92 | Assert.AreEqual(string.Format("Invalid version specified : '{0}'", version), argumentException.Message); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GotoDefn/GotoDefnCommandFilter.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using Gauge.VisualStudio.Model; 17 | using Gauge.VisualStudio.Model.Extensions; 18 | using Microsoft.VisualStudio; 19 | using Microsoft.VisualStudio.OLE.Interop; 20 | using Microsoft.VisualStudio.Shell; 21 | using Microsoft.VisualStudio.Text.Editor; 22 | 23 | namespace Gauge.VisualStudio.GotoDefn 24 | { 25 | internal sealed class GotoDefnCommandFilter : IOleCommandTarget 26 | { 27 | private readonly SVsServiceProvider _serviceProvider; 28 | private readonly Lazy _project; 29 | 30 | public GotoDefnCommandFilter(IWpfTextView textView, SVsServiceProvider serviceProvider) 31 | { 32 | _serviceProvider = serviceProvider; 33 | TextView = textView; 34 | _project = new Lazy(() => ProjectFactory.Get(TextView.TextBuffer.CurrentSnapshot.GetProject(GaugePackage.DTE))); 35 | } 36 | 37 | private IWpfTextView TextView { get; } 38 | public IOleCommandTarget Next { get; set; } 39 | 40 | public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 41 | { 42 | ThreadHelper.ThrowIfNotOnUIThread(); 43 | if (VsShellUtilities.IsInAutomationFunction(_serviceProvider)) 44 | return Next.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 45 | 46 | var hresult = VSConstants.S_OK; 47 | switch ((VSConstants.VSStd97CmdID) nCmdID) 48 | { 49 | case VSConstants.VSStd97CmdID.GotoDefn: 50 | var caretBufferPosition = TextView.Caret.Position.BufferPosition; 51 | var originalText = caretBufferPosition.GetContainingLine().GetText(); 52 | if (!Parser.StepRegex.IsMatch(originalText)) 53 | return hresult; 54 | 55 | //if the current step is a concept, then open the concept file. 56 | //Gauge parses and caches the concepts, its location (file + line number). 57 | //The plugin's job is to simply make an api call and fetch this information. 58 | var stepImplementation = 59 | _project.Value.GetStepImplementation(caretBufferPosition.GetContainingLine()); 60 | 61 | if (stepImplementation == null) 62 | return VSConstants.S_FALSE; 63 | stepImplementation.NavigateToImplementation(GaugePackage.DTE); 64 | return hresult; 65 | default: 66 | hresult = Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 67 | break; 68 | } 69 | 70 | return hresult; 71 | } 72 | 73 | public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) 74 | { 75 | ThreadHelper.ThrowIfNotOnUIThread(); 76 | if ((VSConstants.VSStd97CmdID) prgCmds[0].cmdID != VSConstants.VSStd97CmdID.GotoDefn) 77 | return Next.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); 78 | 79 | prgCmds[0].cmdf = (uint) OLECMDF.OLECMDF_ENABLED | (uint) OLECMDF.OLECMDF_SUPPORTED; 80 | return VSConstants.S_OK; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/Step.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | using Microsoft.VisualStudio.Text; 18 | using System; 19 | using Gauge.Messages; 20 | 21 | namespace Gauge.VisualStudio.Model 22 | { 23 | public class Step : IStep 24 | { 25 | private readonly IGaugeServiceClient _gaugeServiceClient; 26 | 27 | private readonly IProject _project; 28 | private Lazy _stepValueFromInput; 29 | private readonly Lazy> _parameters; 30 | private Lazy _text; 31 | 32 | public Step(IProject project, ITextSnapshotLine inputLine, IGaugeServiceClient gaugeServiceClient) 33 | { 34 | _project = project; 35 | _gaugeServiceClient = gaugeServiceClient; 36 | ContainingLine = inputLine; 37 | _stepValueFromInput = new Lazy(() => _gaugeServiceClient.GetStepValueFromInput(_project.VsProject, GetStepText(inputLine))); 38 | _text = new Lazy(() => _stepValueFromInput.IsValueCreated ? _stepValueFromInput.Value.ParameterizedStepValue : null); 39 | _parameters = new Lazy>(() => _stepValueFromInput.IsValueCreated ? _stepValueFromInput.Value.Parameters.ToList() : null); 40 | } 41 | 42 | public Step(IProject vsProject, ITextSnapshotLine inputLine) : this(vsProject, inputLine, 43 | new GaugeServiceClient()) 44 | { 45 | } 46 | 47 | public ITextSnapshotLine ContainingLine { get; } 48 | 49 | public string Text => _text.Value ?? _stepValueFromInput.Value.ParameterizedStepValue; 50 | 51 | public List Parameters => _parameters.Value ?? _stepValueFromInput.Value.Parameters.ToList(); 52 | 53 | public bool HasInlineTable => CheckForInlineTable(ContainingLine); 54 | 55 | public static string GetStepText(ITextSnapshotLine line) 56 | { 57 | var originalText = line.GetText(); 58 | var match = Parser.StepRegex.Match(originalText); 59 | var stepText = match.Groups["stepText"].Value.Trim(); 60 | 61 | return CheckForInlineTable(line) ? string.Concat(stepText, "
") : stepText; 62 | } 63 | 64 | public static string GetStepValue(ITextSnapshotLine line) 65 | { 66 | return Parser.StepValueRegex.Replace(GetStepText(line), "{}"); 67 | } 68 | 69 | private static bool CheckForInlineTable(ITextSnapshotLine line) 70 | { 71 | if (line == null) 72 | return false; 73 | var nextLineText = NextLineText(line); 74 | return Parser.TableRegex.IsMatch(nextLineText); 75 | } 76 | 77 | private static string NextLineText(ITextSnapshotLine currentLine) 78 | { 79 | ITextSnapshotLine nextLine; 80 | string nextLineText; 81 | try 82 | { 83 | nextLine = currentLine.Snapshot.GetLineFromLineNumber(currentLine.LineNumber + 1); 84 | nextLineText = nextLine.GetText(); 85 | } 86 | catch 87 | { 88 | return string.Empty; 89 | } 90 | return nextLineText.Trim() == string.Empty && currentLine.LineNumber < currentLine.Snapshot.LineCount 91 | ? NextLineText(nextLine) 92 | : nextLineText; 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Highlighting/StepTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.ComponentModel.Composition; 18 | using System.Linq; 19 | using EnvDTE; 20 | using EnvDTE80; 21 | using Gauge.VisualStudio.Core.Extensions; 22 | using Microsoft.VisualStudio.Text; 23 | using Microsoft.VisualStudio.Text.Editor; 24 | using Microsoft.VisualStudio.Text.Tagging; 25 | using Microsoft.VisualStudio.Utilities; 26 | 27 | namespace Gauge.VisualStudio.Highlighting 28 | { 29 | [Export(typeof(IViewTaggerProvider))] 30 | [ContentType(GaugeContentTypeDefinitions.GaugeContentType)] 31 | [Order(Before = "default")] 32 | [TagType(typeof(UnimplementedStepTag))] 33 | [TagType(typeof(DuplicateStepImplementationTag))] 34 | public class StepTaggerProvider : IViewTaggerProvider 35 | { 36 | private readonly Events2 _events2; 37 | 38 | private readonly Dictionary _taggers = 39 | new Dictionary(); 40 | 41 | private readonly CodeModelEvents _codeModelEvents; 42 | private readonly DocumentEvents _documentEvents; 43 | private readonly ProjectItemsEvents _projectItemsEvents; 44 | 45 | public StepTaggerProvider() 46 | { 47 | if (_events2 != null) return; 48 | 49 | _events2 = GaugePackage.DTE.Events as Events2; 50 | _codeModelEvents = _events2.CodeModelEvents; 51 | _projectItemsEvents = _events2.ProjectItemsEvents; 52 | _documentEvents = _events2.DocumentEvents; 53 | 54 | _codeModelEvents.ElementAdded += element => RefreshUsages(); 55 | _codeModelEvents.ElementChanged += (element, change) => RefreshUsages(); 56 | _codeModelEvents.ElementDeleted += (parent, element) => RefreshUsages(); 57 | 58 | _projectItemsEvents.ItemAdded += item => RefreshUsages(); 59 | _projectItemsEvents.ItemRemoved += item => RefreshUsages(); 60 | _projectItemsEvents.ItemRenamed += (item, name) => RefreshUsages(); 61 | 62 | _documentEvents.DocumentSaved += document => 63 | { 64 | if (document.IsGaugeConceptFile() || document.IsGaugeSpecFile()) 65 | { 66 | RefreshUsages(); 67 | } 68 | }; 69 | } 70 | 71 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 72 | { 73 | if (buffer == null || textView == null) 74 | return null; 75 | 76 | if (buffer != textView.TextBuffer) return null; 77 | 78 | try 79 | { 80 | if (!_taggers.ContainsKey(textView)) 81 | _taggers[textView] = new UnimplementedStepTagger(textView); 82 | return _taggers[textView] as ITagger; 83 | } 84 | catch 85 | { 86 | return null; 87 | } 88 | } 89 | 90 | private void RefreshUsages() 91 | { 92 | var unimplementedStepTaggers = _taggers 93 | .Where(unimplementedStepTagger => !unimplementedStepTagger.Key.IsClosed).Select(pair => pair.Value); 94 | foreach (var unimplementedStepTagger in unimplementedStepTaggers) 95 | unimplementedStepTagger.RaiseLayoutChanged(); 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/GaugePackage.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics; 17 | using System.Globalization; 18 | using System.Runtime.InteropServices; 19 | using EnvDTE; 20 | using Gauge.VisualStudio.Core; 21 | using Gauge.VisualStudio.Core.Exceptions; 22 | using Microsoft.VisualStudio; 23 | using Microsoft.VisualStudio.Shell; 24 | using Microsoft.VisualStudio.Shell.Interop; 25 | 26 | namespace Gauge.VisualStudio 27 | { 28 | [PackageRegistration(UseManagedResourcesOnly = true)] 29 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] 30 | [Guid(GuidList.GuidGaugeVsPackagePkgString)] 31 | [ProvideAutoLoad(UIContextGuids80.NoSolution)] 32 | [ProvideEditorFactory(typeof(GaugeEditorFactory), 112)] 33 | [ProvideEditorLogicalView(typeof(GaugeEditorFactory), VSConstants.LOGVIEWID.TextView_string)] 34 | [ProvideEditorExtension(typeof(GaugeEditorFactory), GaugeContentTypeDefinitions.SpecFileExtension, 32)] 35 | [ProvideEditorExtension(typeof(GaugeEditorFactory), GaugeContentTypeDefinitions.ConceptFileExtension, 64)] 36 | [ProvideEditorExtension(typeof(GaugeEditorFactory), GaugeContentTypeDefinitions.MarkdownFileExtension, 32)] 37 | [ProvideLanguageService(typeof(GaugeLanguageInfo), GaugeLanguageInfo.LanguageName, 38 | GaugeLanguageInfo.LanguageResourceId, 39 | DefaultToInsertSpaces = true, 40 | EnableLineNumbers = true, 41 | RequestStockColors = true)] 42 | [ProvideOptionPage(typeof(GaugeDaemonOptions), "Gauge", "API Options", 0, 0, true)] 43 | public class GaugePackage : Package, IDisposable 44 | { 45 | private bool _disposed; 46 | private SolutionsEventListener _solutionsEventListener; 47 | 48 | public static DTE DTE { get; private set; } 49 | 50 | public void Dispose() 51 | { 52 | Dispose(true); 53 | GC.SuppressFinalize(this); 54 | } 55 | 56 | protected override void Initialize() 57 | { 58 | ThreadHelper.ThrowIfNotOnUIThread(); 59 | Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString())); 60 | try 61 | { 62 | GaugeService.AssertCompatibility(); 63 | } 64 | catch (GaugeVersionIncompatibleException ex) 65 | { 66 | var message = $"{ex.Message}\n{ex.Data["GaugeError"].ToString()}"; 67 | Debug.WriteLine(message); 68 | throw new InvalidOperationException(message); 69 | } 70 | catch (GaugeVersionNotFoundException ex) 71 | { 72 | var message = $"{ex.Message}\n{ex.Data["GaugeError"].ToString()}"; 73 | Debug.WriteLine(message); 74 | throw new InvalidOperationException(message); 75 | } 76 | 77 | base.Initialize(); 78 | 79 | DTE = (DTE) GetService(typeof(DTE)); 80 | 81 | RegisterEditorFactory(new GaugeEditorFactory(this)); 82 | var options = GetDialogPage(typeof(GaugeDaemonOptions)) as GaugeDaemonOptions; 83 | _solutionsEventListener = new SolutionsEventListener(options, this); 84 | } 85 | 86 | protected override void Dispose(bool disposing) 87 | { 88 | if (_disposed) 89 | return; 90 | 91 | if (disposing) 92 | _solutionsEventListener?.Dispose(); 93 | 94 | _disposed = true; 95 | base.Dispose(disposing); 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/Classification/Formats.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.ComponentModel.Composition; 16 | using Microsoft.VisualStudio.Text.Classification; 17 | using Microsoft.VisualStudio.Utilities; 18 | 19 | namespace Gauge.VisualStudio.Classification 20 | { 21 | internal static class Formats 22 | { 23 | [Export(typeof(EditorFormatDefinition))] 24 | [ClassificationType(ClassificationTypeNames = "gauge.specification")] 25 | [Name("gauge.specification")] 26 | [DisplayName("Gauge Specification")] 27 | [UserVisible(true)] 28 | private sealed class GaugeSpecificationFormat : ClassificationFormatDefinition 29 | { 30 | public GaugeSpecificationFormat() 31 | { 32 | FontRenderingSize = 18; 33 | IsBold = true; 34 | } 35 | } 36 | 37 | [Export(typeof(EditorFormatDefinition))] 38 | [ClassificationType(ClassificationTypeNames = "gauge.scenario")] 39 | [Name("gauge.scenario")] 40 | [DisplayName("Gauge Scenario")] 41 | [UserVisible(true)] 42 | private sealed class GaugeScenarioFormat : ClassificationFormatDefinition 43 | { 44 | public GaugeScenarioFormat() 45 | { 46 | FontRenderingSize = 16; 47 | IsBold = true; 48 | } 49 | } 50 | 51 | [Export(typeof(EditorFormatDefinition))] 52 | [ClassificationType(ClassificationTypeNames = "gauge.step")] 53 | [Name("gauge.step")] 54 | [DisplayName("Gauge Step")] 55 | [UserVisible(true)] 56 | private sealed class GaugeStepFormat : ClassificationFormatDefinition 57 | { 58 | } 59 | 60 | [Export(typeof(EditorFormatDefinition))] 61 | [ClassificationType(ClassificationTypeNames = "gauge.static_param")] 62 | [Name("gauge.static_param")] 63 | [DisplayName("Gauge Static Parameter")] 64 | [UserVisible(true)] 65 | private sealed class GaugeStaticParamFormat : ClassificationFormatDefinition 66 | { 67 | public GaugeStaticParamFormat() 68 | { 69 | IsBold = true; 70 | } 71 | } 72 | 73 | [Export(typeof(EditorFormatDefinition))] 74 | [ClassificationType(ClassificationTypeNames = "gauge.dynamic_param")] 75 | [Name("gauge.dynamic_param")] 76 | [DisplayName("Gauge Dynamic Parameter")] 77 | [UserVisible(true)] 78 | private sealed class GaugeDynamicParamFormat : ClassificationFormatDefinition 79 | { 80 | public GaugeDynamicParamFormat() 81 | { 82 | IsBold = true; 83 | } 84 | } 85 | 86 | [Export(typeof(EditorFormatDefinition))] 87 | [ClassificationType(ClassificationTypeNames = "gauge.tag")] 88 | [Name("gauge.tag")] 89 | [DisplayName("Gauge Tag")] 90 | [UserVisible(true)] 91 | private sealed class GaugeTagFormat : ClassificationFormatDefinition 92 | { 93 | public GaugeTagFormat() 94 | { 95 | IsBold = true; 96 | } 97 | } 98 | 99 | [Export(typeof(EditorFormatDefinition))] 100 | [ClassificationType(ClassificationTypeNames = "gauge.tagvalue")] 101 | [Name("gauge.tagvalue")] 102 | [DisplayName("Gauge Tag Value")] 103 | [UserVisible(true)] 104 | private sealed class GaugeTagValueFormat : ClassificationFormatDefinition 105 | { 106 | public GaugeTagValueFormat() 107 | { 108 | IsBold = true; 109 | IsItalic = true; 110 | } 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio/References/FindReferencesCommandFilter.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using EnvDTE; 17 | using EnvDTE80; 18 | using Gauge.VisualStudio.Model; 19 | using Gauge.VisualStudio.Model.Extensions; 20 | using Microsoft.VisualStudio; 21 | using Microsoft.VisualStudio.OLE.Interop; 22 | using Microsoft.VisualStudio.Shell; 23 | using Microsoft.VisualStudio.Text.Editor; 24 | 25 | namespace Gauge.VisualStudio.References 26 | { 27 | internal sealed class FindReferencesCommandFilter : IOleCommandTarget 28 | { 29 | private readonly SVsServiceProvider _serviceProvider; 30 | 31 | public FindReferencesCommandFilter(IWpfTextView textView, SVsServiceProvider serviceProvider) 32 | { 33 | _serviceProvider = serviceProvider; 34 | TextView = textView; 35 | } 36 | 37 | public IOleCommandTarget Next { get; set; } 38 | private IWpfTextView TextView { get; } 39 | 40 | public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 41 | { 42 | ThreadHelper.ThrowIfNotOnUIThread(); 43 | if (VsShellUtilities.IsInAutomationFunction(_serviceProvider)) 44 | return Next.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 45 | 46 | var hresult = VSConstants.S_OK; 47 | switch ((VSConstants.VSStd97CmdID) nCmdID) 48 | { 49 | case VSConstants.VSStd97CmdID.FindReferences: 50 | var caretBufferPosition = TextView.Caret.Position.BufferPosition; 51 | var originalText = Step.GetStepText(caretBufferPosition.GetContainingLine()); 52 | 53 | var findRegex = 54 | new GaugeServiceClient().GetFindRegex(caretBufferPosition.Snapshot.GetProject(GaugePackage.DTE), 55 | originalText); 56 | 57 | var _dte = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2; 58 | var find = (Find2) _dte.Find; 59 | 60 | var types = find.FilesOfType; 61 | var matchCase = find.MatchCase; 62 | var matchWord = find.MatchWholeWord; 63 | 64 | find.WaitForFindToComplete = false; 65 | find.Action = vsFindAction.vsFindActionFindAll; 66 | find.Backwards = false; 67 | find.MatchInHiddenText = true; 68 | find.MatchWholeWord = true; 69 | find.MatchCase = false; 70 | find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr; 71 | find.ResultsLocation = vsFindResultsLocation.vsFindResults1; 72 | find.SearchSubfolders = true; 73 | find.Target = vsFindTarget.vsFindTargetSolution; 74 | find.FindWhat = findRegex; 75 | find.Execute(); 76 | 77 | find.FilesOfType = types; 78 | find.MatchCase = matchCase; 79 | find.MatchWholeWord = matchWord; 80 | 81 | return hresult; 82 | default: 83 | hresult = Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); 84 | break; 85 | } 86 | return hresult; 87 | } 88 | 89 | public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) 90 | { 91 | ThreadHelper.ThrowIfNotOnUIThread(); 92 | if ((VSConstants.VSStd97CmdID) prgCmds[0].cmdID != VSConstants.VSStd97CmdID.FindReferences) 93 | return Next.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); 94 | 95 | prgCmds[0].cmdf = (uint) OLECMDF.OLECMDF_ENABLED | (uint) OLECMDF.OLECMDF_SUPPORTED; 96 | return VSConstants.S_OK; 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /Gauge.VisualStudio.Core.Tests/Gauge.VisualStudio.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {44A99A24-DE66-4FF1-8683-E001F5B7C55B} 9 | Library 10 | Properties 11 | Gauge.VisualStudio.Core.Tests 12 | Gauge.VisualStudio.Core.Tests 13 | v4.6 14 | 512 15 | ..\ 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {24C4951F-15A5-4C76-9A20-2E456A21500E} 60 | Gauge.VisualStudio.Core 61 | 62 | 63 | 64 | 65 | 66 | 67 | 74 | 75 | 76 | 77 | 78 | ..\packages\test\FakeItEasy\lib\net45\FakeItEasy.dll 79 | True 80 | True 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | ..\packages\test\NUnit\lib\net45\nunit.framework.dll 90 | True 91 | True 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2026 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{6091572D-7818-4589-8021-E5977B411AC3}" 7 | ProjectSection(SolutionItems) = preProject 8 | paket.dependencies = paket.dependencies 9 | EndProjectSection 10 | EndProject 11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.Tests", "Gauge.VisualStudio.Tests\Gauge.VisualStudio.Tests.csproj", "{754095AA-91B0-40E4-98AD-3FD8746DB95D}" 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.TestAdapter", "Gauge.VisualStudio.TestAdapter\Gauge.VisualStudio.TestAdapter.csproj", "{62F2F1DA-2357-4F63-991A-5449B3F31E00}" 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.Model", "Gauge.VisualStudio.Model\Gauge.VisualStudio.Model.csproj", "{6990376B-FD73-4A61-A26C-3C2FC9429164}" 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.Model.Tests", "Gauge.VisualStudio.Model.Tests\Gauge.VisualStudio.Model.Tests.csproj", "{11C8F0C3-1654-4B5C-BD87-7C7458485F4A}" 18 | EndProject 19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.Core", "Gauge.VisualStudio.Core\Gauge.VisualStudio.Core.csproj", "{24C4951F-15A5-4C76-9A20-2E456A21500E}" 20 | EndProject 21 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio.Core.Tests", "Gauge.VisualStudio.Core.Tests\Gauge.VisualStudio.Core.Tests.csproj", "{44A99A24-DE66-4FF1-8683-E001F5B7C55B}" 22 | EndProject 23 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gauge.VisualStudio", "Gauge.VisualStudio\Gauge.VisualStudio.csproj", "{DC3355B9-8179-48A6-9A01-0E96F2FB842E}" 24 | EndProject 25 | Global 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|Any CPU = Debug|Any CPU 28 | Release|Any CPU = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 31 | {754095AA-91B0-40E4-98AD-3FD8746DB95D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {754095AA-91B0-40E4-98AD-3FD8746DB95D}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {754095AA-91B0-40E4-98AD-3FD8746DB95D}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {754095AA-91B0-40E4-98AD-3FD8746DB95D}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {62F2F1DA-2357-4F63-991A-5449B3F31E00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {62F2F1DA-2357-4F63-991A-5449B3F31E00}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {62F2F1DA-2357-4F63-991A-5449B3F31E00}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {62F2F1DA-2357-4F63-991A-5449B3F31E00}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {6990376B-FD73-4A61-A26C-3C2FC9429164}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {6990376B-FD73-4A61-A26C-3C2FC9429164}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {6990376B-FD73-4A61-A26C-3C2FC9429164}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {6990376B-FD73-4A61-A26C-3C2FC9429164}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {11C8F0C3-1654-4B5C-BD87-7C7458485F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {11C8F0C3-1654-4B5C-BD87-7C7458485F4A}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {11C8F0C3-1654-4B5C-BD87-7C7458485F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {11C8F0C3-1654-4B5C-BD87-7C7458485F4A}.Release|Any CPU.Build.0 = Release|Any CPU 47 | {24C4951F-15A5-4C76-9A20-2E456A21500E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 48 | {24C4951F-15A5-4C76-9A20-2E456A21500E}.Debug|Any CPU.Build.0 = Debug|Any CPU 49 | {24C4951F-15A5-4C76-9A20-2E456A21500E}.Release|Any CPU.ActiveCfg = Release|Any CPU 50 | {24C4951F-15A5-4C76-9A20-2E456A21500E}.Release|Any CPU.Build.0 = Release|Any CPU 51 | {44A99A24-DE66-4FF1-8683-E001F5B7C55B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 52 | {44A99A24-DE66-4FF1-8683-E001F5B7C55B}.Debug|Any CPU.Build.0 = Debug|Any CPU 53 | {44A99A24-DE66-4FF1-8683-E001F5B7C55B}.Release|Any CPU.ActiveCfg = Release|Any CPU 54 | {44A99A24-DE66-4FF1-8683-E001F5B7C55B}.Release|Any CPU.Build.0 = Release|Any CPU 55 | {DC3355B9-8179-48A6-9A01-0E96F2FB842E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 56 | {DC3355B9-8179-48A6-9A01-0E96F2FB842E}.Debug|Any CPU.Build.0 = Debug|Any CPU 57 | {DC3355B9-8179-48A6-9A01-0E96F2FB842E}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 | {DC3355B9-8179-48A6-9A01-0E96F2FB842E}.Release|Any CPU.Build.0 = Release|Any CPU 59 | EndGlobalSection 60 | GlobalSection(SolutionProperties) = preSolution 61 | HideSolutionNode = FALSE 62 | EndGlobalSection 63 | GlobalSection(ExtensibilityGlobals) = postSolution 64 | SolutionGuid = {8F4A0FE0-41D7-4B62-8132-D45D87F40DA0} 65 | EndGlobalSection 66 | EndGlobal 67 | -------------------------------------------------------------------------------- /Gauge.VisualStudio.Model/GaugeServiceClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright [2014, 2015] [ThoughtWorks Inc.](www.thoughtworks.com) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using Gauge.CSharp.Core; 19 | using Gauge.Messages; 20 | using Gauge.VisualStudio.Core; 21 | 22 | namespace Gauge.VisualStudio.Model 23 | { 24 | public class GaugeServiceClient : IGaugeServiceClient 25 | { 26 | private readonly IGaugeService _gaugeService; 27 | 28 | public GaugeServiceClient(IGaugeService gaugeService) 29 | { 30 | _gaugeService = gaugeService; 31 | } 32 | 33 | public GaugeServiceClient() : this(GaugeService.Instance) 34 | { 35 | } 36 | 37 | public string GetParsedStepValueFromInput(EnvDTE.Project project, string input) 38 | { 39 | var stepValueFromInput = GetStepValueFromInput(project, input); 40 | return stepValueFromInput == null ? string.Empty : stepValueFromInput.StepValue; 41 | } 42 | 43 | public string GetFindRegex(EnvDTE.Project project, string input) 44 | { 45 | if (input.EndsWith("
", StringComparison.Ordinal)) 46 | input = input.Remove(input.LastIndexOf("
", StringComparison.Ordinal)); 47 | var parsedValue = GetParsedStepValueFromInput(project, input); 48 | parsedValue = parsedValue.Replace("* ", ""); 49 | return $@"^(\*[ |\t]*|[ |\t]*\[Step\(""){ 50 | parsedValue.Replace("{}", "((<|\")(?!
).+(>|\"))") 51 | }\s*(((\r?\n\s*)+\|([\w ]+\|)+)|(
))?(""\)\])?\r?\n"; 52 | } 53 | 54 | public ProtoStepValue GetStepValueFromInput(EnvDTE.Project project, string input) 55 | { 56 | var gaugeApiConnection = _gaugeService.GetApiConnectionFor(project); 57 | var stepsRequest = new GetStepValueRequest { StepText = input }; 58 | var apiMessage = new APIMessage 59 | { 60 | MessageId = GenerateMessageId(), 61 | MessageType = APIMessage.Types.APIMessageType.GetStepValueRequest, 62 | StepValueRequest = stepsRequest 63 | }; 64 | 65 | var bytes = gaugeApiConnection.WriteAndReadApiMessage(apiMessage); 66 | return bytes.StepValueResponse.StepValue; 67 | } 68 | 69 | public IEnumerable GetAllStepsFromGauge(EnvDTE.Project project) 70 | { 71 | var gaugeApiConnection = _gaugeService.GetApiConnectionFor(project); 72 | 73 | if (gaugeApiConnection == null) 74 | return Enumerable.Empty(); 75 | var stepsRequest = new GetAllStepsRequest(); 76 | var apiMessage = new APIMessage 77 | { 78 | MessageId = GenerateMessageId(), 79 | MessageType = APIMessage.Types.APIMessageType.GetAllStepsRequest, 80 | AllStepsRequest = stepsRequest 81 | }; 82 | 83 | var bytes = gaugeApiConnection.WriteAndReadApiMessage(apiMessage); 84 | return bytes.AllStepsResponse.AllSteps; 85 | } 86 | 87 | public IEnumerable GetSpecsFromGauge(IGaugeApiConnection apiConnection) 88 | { 89 | var specsRequest = new SpecsRequest(); 90 | var apiMessage = new APIMessage 91 | { 92 | MessageId = GenerateMessageId(), 93 | MessageType = APIMessage.Types.APIMessageType.SpecsRequest, 94 | SpecsRequest = specsRequest 95 | }; 96 | 97 | var bytes = apiConnection.WriteAndReadApiMessage(apiMessage); 98 | 99 | var specs = bytes.SpecsResponse.Details.Where(detail => detail.Spec != null).Select(detail => detail.Spec); 100 | return specs; 101 | } 102 | 103 | public static long GenerateMessageId() 104 | { 105 | return DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; 106 | } 107 | 108 | public IEnumerable GetSpecsFromGauge(int apiPort) 109 | { 110 | return GetSpecsFromGauge(new GaugeApiConnection(new TcpClientWrapper(apiPort))); 111 | } 112 | } 113 | } --------------------------------------------------------------------------------