├── VSPackage ├── Templates │ ├── Items │ │ ├── Text File │ │ │ ├── Text.txt │ │ │ ├── Text.ico │ │ │ └── Text.vstemplate │ │ └── Boo Class │ │ │ ├── Class.ico │ │ │ ├── Class.boo │ │ │ └── Class.vstemplate │ └── Projects │ │ ├── Boo Library │ │ ├── ClassLibrary.ico │ │ ├── Class.boo │ │ ├── Library.vstemplate │ │ ├── AssemblyInfo.boo │ │ └── Library.booproj │ │ └── Boo Application │ │ ├── ConsoleApplication.ico │ │ ├── Program.boo │ │ ├── Application.vstemplate │ │ ├── AssemblyInfo.boo │ │ └── Application.booproj ├── Key.snk ├── boo.ico ├── BooLogo.png ├── Boo_files │ ├── boo.exe │ ├── booc.exe │ ├── booi.exe │ ├── booish.exe │ ├── Boo.Lang.dll │ ├── Boo.NAnt.Tasks.dll │ ├── Boo.Lang.CodeDom.dll │ ├── Boo.Lang.Compiler.dll │ ├── Boo.Lang.Parser.dll │ ├── Boo.Lang.Useful.dll │ ├── Boo.Lang.Extensions.dll │ ├── Boo.Lang.Interpreter.dll │ ├── Boo.Lang.PatternMatching.dll │ ├── booc.exe.config │ ├── booi.exe.config │ ├── booish.exe.config │ ├── Boo.LanguageSetup.targets │ ├── booc.rsp │ └── Boo.Microsoft.Build.targets ├── Resources │ ├── 301.bmp │ ├── BooISh.bmp │ ├── Package.ico │ ├── imagelis.bmp │ ├── BooFileNode.bmp │ ├── Images_32bit.bmp │ └── BooProjectNode.bmp ├── Boo.ProjectIcon.png ├── VSPackage_UnitTests │ ├── Key.snk │ ├── PackageTest.cs │ ├── MenuItemTests │ │ ├── UIShellServiceMock.cs │ │ └── MenuItemCallback.cs │ └── VSPackage_UnitTests.csproj ├── VSPackage_IntegrationTests │ ├── Key.snk │ ├── SignOff-Tests │ │ ├── SolutionTests.cs │ │ └── CSharpProjectTests.cs │ ├── PackageTest.cs │ └── MenuItemTest.cs ├── Project │ ├── Attributes │ │ ├── LocDisplayNameAttribute.cs │ │ ├── ResourcesCategoryAttribute.cs │ │ └── ResourcesDescriptionAttribute.cs │ ├── ProjectProperties │ │ └── BooProjectNodeProperties.cs │ └── BooProjectFactory.cs ├── GlobalSuppressions.cs ├── BooISh │ ├── BooIShControl.xaml │ ├── Window.cs │ ├── BooIShWrapper.cs │ └── BooIShControl.xaml.cs ├── Constants.cs ├── source.extension.vsixmanifest ├── LanguageService │ ├── Colorizer │ │ ├── ClassifierProvider.cs │ │ ├── TaggerProvider.cs │ │ ├── Tagger.cs │ │ └── Classifier.cs │ └── BooAuthoringScope.cs └── Properties │ └── AssemblyInfo.cs ├── ASTMapper ├── Key.snk ├── AST │ ├── Walkers │ │ └── CompletedModuleWalker.cs │ ├── Nodes │ │ ├── MappedImport.cs │ │ ├── ParsingError.cs │ │ ├── MappedTypeDefinition.cs │ │ ├── MappedTypeMemberDefinition.cs │ │ ├── MappedVariableDefinition.cs │ │ ├── MappedMacroReference.cs │ │ ├── MappedAttribute.cs │ │ └── MappedTypeReference.cs │ └── MappedToken.cs ├── Properties │ └── AssemblyInfo.cs ├── IFileNode.cs ├── CompilerMessage.cs └── TextSpanExtensions.cs ├── MPFProject ├── Key.snk ├── Utilities.cs ├── ProjectNode.cs ├── Resources │ └── imagelis.bmp ├── Automation │ ├── OAProject.cs │ ├── OAFolderItem.cs │ ├── OAReferenceFolderItem.cs │ ├── VSProject │ │ ├── OAVSProjectItem.cs │ │ ├── OAComReference.cs │ │ ├── OAProjectReference.cs │ │ └── OABuildManager.cs │ ├── OANestedProjectItem.cs │ ├── OANullProperty.cs │ ├── OAReferenceItem.cs │ └── AutomationScope.cs ├── MPFProjectAll.files ├── Properties │ └── AssemblyInfo.cs ├── WebProjectBase.Files ├── ProjectNode.Events.cs ├── Diagrams │ ├── DocumentManagerClasses.cd │ ├── ConfigurationClasses.cd │ ├── PropertiesClasses.cd │ ├── ReferenceClasses.cd │ └── HierarchyClasses.cd ├── ConfigurationProperties.cs ├── PropertiesEditorLauncher.cs ├── NestedProjectBuildDependency.cs ├── Tracing.cs ├── VSShellUtilities.cs ├── BuildPropertyPage.cs ├── Attributes.cs ├── SolutionListenerForProjectOpen.cs ├── ProjectPackage.cs ├── BuildDependency.cs ├── ProjectOptions.cs ├── ProjectDesignerDocumentManager.cs ├── EnumDependencies.cs ├── Misc │ ├── ExternDll.cs │ └── UnsafeNativeMethods.cs ├── LocalizableProperties.cs ├── SolutionListenerForProjectEvents.cs └── BuildStatus.cs ├── Dependencies └── nunit.framework.dll ├── BoocNET35 ├── app.config ├── Program.cs ├── Pipeline.cs ├── Properties │ └── AssemblyInfo.cs └── BoocNET35.csproj ├── BoocNET40 ├── app.config ├── Program.cs ├── Pipeline.cs ├── Properties │ └── AssemblyInfo.cs └── BoocNET40.csproj ├── .gitignore ├── UnitTests.testsettings ├── VSPackage.vsmdi ├── IntegrationTests.testsettings ├── Readme.txt ├── MapperTests ├── MiscellaneousTests.cs ├── Properties │ └── AssemblyInfo.cs └── TestBase.cs └── MSBuildUtilities ├── Properties └── AssemblyInfo.cs └── MSBuildUtilities.csproj /VSPackage/Templates/Items/Text File/Text.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ASTMapper/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/ASTMapper/Key.snk -------------------------------------------------------------------------------- /MPFProject/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/MPFProject/Key.snk -------------------------------------------------------------------------------- /VSPackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Key.snk -------------------------------------------------------------------------------- /VSPackage/boo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/boo.ico -------------------------------------------------------------------------------- /VSPackage/BooLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/BooLogo.png -------------------------------------------------------------------------------- /MPFProject/Utilities.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/MPFProject/Utilities.cs -------------------------------------------------------------------------------- /MPFProject/ProjectNode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/MPFProject/ProjectNode.cs -------------------------------------------------------------------------------- /VSPackage/Boo_files/boo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/boo.exe -------------------------------------------------------------------------------- /VSPackage/Boo_files/booc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/booc.exe -------------------------------------------------------------------------------- /VSPackage/Boo_files/booi.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/booi.exe -------------------------------------------------------------------------------- /VSPackage/Resources/301.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/301.bmp -------------------------------------------------------------------------------- /VSPackage/Boo.ProjectIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo.ProjectIcon.png -------------------------------------------------------------------------------- /VSPackage/Boo_files/booish.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/booish.exe -------------------------------------------------------------------------------- /VSPackage/Resources/BooISh.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/BooISh.bmp -------------------------------------------------------------------------------- /VSPackage/Resources/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/Package.ico -------------------------------------------------------------------------------- /Dependencies/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/Dependencies/nunit.framework.dll -------------------------------------------------------------------------------- /MPFProject/Resources/imagelis.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/MPFProject/Resources/imagelis.bmp -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.dll -------------------------------------------------------------------------------- /VSPackage/Resources/imagelis.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/imagelis.bmp -------------------------------------------------------------------------------- /MPFProject/Automation/OAProject.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/MPFProject/Automation/OAProject.cs -------------------------------------------------------------------------------- /VSPackage/Resources/BooFileNode.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/BooFileNode.bmp -------------------------------------------------------------------------------- /VSPackage/Resources/Images_32bit.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/Images_32bit.bmp -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.NAnt.Tasks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.NAnt.Tasks.dll -------------------------------------------------------------------------------- /VSPackage/Resources/BooProjectNode.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Resources/BooProjectNode.bmp -------------------------------------------------------------------------------- /VSPackage/VSPackage_UnitTests/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/VSPackage_UnitTests/Key.snk -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.CodeDom.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.CodeDom.dll -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.Compiler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.Compiler.dll -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.Parser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.Parser.dll -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.Useful.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.Useful.dll -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.Extensions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.Extensions.dll -------------------------------------------------------------------------------- /BoocNET35/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /BoocNET40/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.Interpreter.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.Interpreter.dll -------------------------------------------------------------------------------- /VSPackage/Templates/Items/Boo Class/Class.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Templates/Items/Boo Class/Class.ico -------------------------------------------------------------------------------- /VSPackage/Templates/Items/Text File/Text.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Templates/Items/Text File/Text.ico -------------------------------------------------------------------------------- /VSPackage/VSPackage_IntegrationTests/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/VSPackage_IntegrationTests/Key.snk -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Lang.PatternMatching.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Boo_files/Boo.Lang.PatternMatching.dll -------------------------------------------------------------------------------- /VSPackage/Project/Attributes/LocDisplayNameAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Project/Attributes/LocDisplayNameAttribute.cs -------------------------------------------------------------------------------- /VSPackage/Project/Attributes/ResourcesCategoryAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Project/Attributes/ResourcesCategoryAttribute.cs -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Library/ClassLibrary.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Templates/Projects/Boo Library/ClassLibrary.ico -------------------------------------------------------------------------------- /VSPackage/Project/Attributes/ResourcesDescriptionAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Project/Attributes/ResourcesDescriptionAttribute.cs -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Application/ConsoleApplication.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfeingold/Boo-Plugin/HEAD/VSPackage/Templates/Projects/Boo Application/ConsoleApplication.ico -------------------------------------------------------------------------------- /VSPackage/Templates/Items/Boo Class/Class.boo: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$ 2 | 3 | import System 4 | 5 | class $safeitemname$: 6 | """Description of $safeitemname$.""" 7 | 8 | public def constructor(): 9 | pass 10 | -------------------------------------------------------------------------------- /BoocNET35/Program.cs: -------------------------------------------------------------------------------- 1 | using booc; 2 | 3 | namespace boocNET35 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | App.Main(args); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BoocNET40/Program.cs: -------------------------------------------------------------------------------- 1 | using booc; 2 | 3 | namespace boocNET40 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | App.Main(args); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Library/Class.boo: -------------------------------------------------------------------------------- 1 | namespace $safeprojectname$ 2 | 3 | import System 4 | 5 | class $safeitemname$: 6 | """Description of $safeitemname$.""" 7 | 8 | public def constructor(): 9 | pass 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | */bin 3 | */obj 4 | */*/bin 5 | */*/obj 6 | *.user 7 | _ReSharper.VisualBoo/* 8 | TestResults/* 9 | VSPackage/Boo_files/Boo.MSBuildUtilities.* 10 | VSPackage/Boo_files/boocNET35.* 11 | VSPackage/Boo_files/boocNET40.* 12 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Application/Program.boo: -------------------------------------------------------------------------------- 1 | namespace $safeprojectname$ 2 | 3 | import System 4 | 5 | print "Hello, World!" 6 | 7 | // TODO: Implement Functionality Here 8 | 9 | print "Press any key to continue . . . " 10 | Console.ReadKey(true) -------------------------------------------------------------------------------- /BoocNET35/Pipeline.cs: -------------------------------------------------------------------------------- 1 | using Boo.Lang.Compiler.Pipelines; 2 | 3 | namespace boocNET35 4 | { 5 | public class PipeLine : CompileToFile 6 | { 7 | public PipeLine() 8 | { 9 | BreakOnErrors = false; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BoocNET40/Pipeline.cs: -------------------------------------------------------------------------------- 1 | using Boo.Lang.Compiler.Pipelines; 2 | 3 | namespace boocNET40 4 | { 5 | public class PipeLine : CompileToFile 6 | { 7 | public PipeLine() 8 | { 9 | BreakOnErrors = false; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/booc.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/booi.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/booish.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.LanguageSetup.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | .boo 4 | Boo 5 | 6 | 7 | -------------------------------------------------------------------------------- /UnitTests.testsettings: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | This test run configuration is used for running the unit tests 9 | 10 | -------------------------------------------------------------------------------- /MPFProject/MPFProjectAll.files: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | . 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /VSPackage.vsmdi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /VSPackage/Templates/Items/Text File/Text.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | Text file 4 | empty text file 5 | Text.ico 6 | Visual Boo 7 | 180 8 | Text.txt 9 | 10 | 11 | Text.txt 12 | 13 | 14 | -------------------------------------------------------------------------------- /VSPackage/Templates/Items/Boo Class/Class.vstemplate: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class 4 | empty class definition 5 | Class.ico 6 | Visual Boo 7 | 180 8 | Class.boo 9 | 10 | 11 | Class.boo 12 | 13 | 14 | -------------------------------------------------------------------------------- /VSPackage/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] 12 | -------------------------------------------------------------------------------- /IntegrationTests.testsettings: -------------------------------------------------------------------------------- 1 | 2 | 7 | This test run configuration uses the VS IDE host type in the test run. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/booc.rsp: -------------------------------------------------------------------------------- 1 | # This file contains command-line options that the Boo 2 | # command-line compiler (booc) will process as part 3 | # of every compilation, unless the "-noconfig" option 4 | # is specified. 5 | 6 | # Reference the common Framework libraries 7 | #-r:System (already included by boo) 8 | #-r:System.Data 9 | -r:System.Drawing 10 | #-r:System.Management 11 | #-r:System.Messaging 12 | #-r:System.Runtime.Remoting 13 | #-r:System.Runtime.Serialization.Formatters.Soap 14 | # does not work nicely on mono 15 | -r:System.Security 16 | #-r:System.ServiceProcess 17 | #-r:System.Web 18 | #-r:System.Web.Services 19 | #-r:System.Windows.Forms 20 | -r:System.Xml 21 | -------------------------------------------------------------------------------- /VSPackage/Project/ProjectProperties/BooProjectNodeProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Project; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace Hill30.BooProject.Project.ProjectProperties 6 | { 7 | [CLSCompliant(false), ComVisible(true)] 8 | public class BooProjectNodeProperties : ProjectNodeProperties 9 | { 10 | public BooProjectNodeProperties(ProjectNode node) 11 | : base(node) 12 | { 13 | } 14 | 15 | // this is a remnant of my struggle with the cross project type resolution. I will have to revisit it 16 | // in the future 17 | //[Browsable(false)] 18 | //public References DesignTimeReferences 19 | //{ 20 | // get 21 | // { 22 | // return null; 23 | // } 24 | //} 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Library/Library.vstemplate: -------------------------------------------------------------------------------- 1 | 3 | 4 | Class Library 5 | Project for building a class library in Boo 6 | CLassLibrary.ico 7 | Visual Boo 8 | ClassLibrary 9 | true 10 | 11 | 12 | 13 | Class.boo 14 | AssemblyInfo.boo 15 | 16 | 17 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Application/Application.vstemplate: -------------------------------------------------------------------------------- 1 | 3 | 4 | Console Application 5 | Project for building a command-line application in Boo 6 | ConsoleApplication.ico 7 | Visual Boo 8 | ConsoleApplication 9 | true 10 | 11 | 12 | 13 | Program.boo 14 | AssemblyInfo.boo 15 | 16 | 17 | -------------------------------------------------------------------------------- /MPFProject/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | using System.Security.Permissions; 6 | using System.Resources; 7 | 8 | [assembly: AssemblyTitle("Microsoft.VisualStudio.Project")] 9 | [assembly: AssemblyDescription("MPF Implementation of VS Projects")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Microsoft.VisualStudio.Project")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2009")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | [assembly: ComVisible(false)] 18 | [assembly: CLSCompliant(false)] 19 | 20 | [assembly: Guid("084954ec-af04-4ea3-b166-b1fced604dc8")] 21 | 22 | [assembly: AssemblyVersion("1.0.0.0")] 23 | [assembly: AssemblyFileVersion("1.0.0.0")] 24 | 25 | [assembly: NeutralResourcesLanguageAttribute("en")] 26 | -------------------------------------------------------------------------------- /VSPackage/BooISh/BooIShControl.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ASTMapper/AST/Walkers/CompletedModuleWalker.cs: -------------------------------------------------------------------------------- 1 | using Boo.Lang.Compiler.Ast; 2 | using Hill30.Boo.ASTMapper.AST.Nodes; 3 | 4 | namespace Hill30.Boo.ASTMapper.AST.Walkers 5 | { 6 | public class CompletedModuleWalker : DepthFirstVisitor 7 | { 8 | private readonly CompileResults results; 9 | public CompletedModuleWalker(CompileResults results) 10 | { 11 | this.results = results; 12 | } 13 | 14 | public override void OnLocal(Local node) 15 | { 16 | if (node.LexicalInfo != null) 17 | results.MapParsedNode(new MappedVariableDefinition(results, node)); 18 | base.OnLocal(node); 19 | } 20 | 21 | public override void OnMemberReferenceExpression(MemberReferenceExpression node) 22 | { 23 | if (node.LexicalInfo != null) 24 | results.MapNode(RecordingStage.Completed, new MappedReferenceExpression(results, node)); 25 | base.OnReferenceExpression(node); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedImport.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class MappedImport : MappedNode 21 | { 22 | public MappedImport(CompileResults results, Import node) 23 | : base(results, node, node.Namespace.Length) 24 | { 25 | } 26 | 27 | public override MappedNodeType Type 28 | { 29 | get { return MappedNodeType.Import; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/ParsingError.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class ParsingError: MappedNode 21 | { 22 | public ParsingError(CompileResults results, LexicalInfo lexicalInfo, int length) 23 | : base(results, lexicalInfo, length) 24 | { 25 | } 26 | 27 | public override MappedNodeType Type 28 | { 29 | get { return MappedNodeType.ParsingError; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | Here is what you need to build the Boo: Visual Studio extension: 2 | 3 | 1. Visual Studio 2010 4 | 5 | 2. Visual Studio 2010 SDK - you can download it [[here|http://www.microsoft.com/downloads/en/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&displaylang=en]] 6 | 7 | 3. The code from this repository. This code includes the solution with the extension projects. The Microsoft.VisualStudio.Project project from the solution is a fork from [[Managed Package Framework for Projects|http://mpfproj10.codeplex.com/]] rev 55578. The BooProject project also has a set of boo files from boo distribution (in the boo_files subdirectory) 8 | 9 | To run the extension set the BooProject as startup project and run the solution. 10 | It will open a new instance of VisualStudio running in Experimental Hive, meaning that all registry/file changes necessary 11 | to make the extension available are made in a separate set of registry entries/directories and can be easily rolled back 12 | without affecting your working instance of Visual Studio. 13 | 14 | To make available the version you compiled in the main hive, find the BooPlugin.vsix file in the bin folder of the BooProject and run it. 15 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Application/AssemblyInfo.boo: -------------------------------------------------------------------------------- 1 | import System.Reflection 2 | import 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("$projectname$")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("$projectname$")] 12 | [assembly: AssemblyCopyright("Copyright $registeredorganization$ $time$")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // This sets the default COM visibility of types in the assembly to invisible. 17 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The assembly version has following format : 21 | // 22 | // Major.Minor.Build.Revision 23 | // 24 | // You can specify all values by your own or you can build default build and revision 25 | // numbers with the '*' character (the default): 26 | 27 | [assembly: AssemblyVersion("1.0.*")] 28 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Library/AssemblyInfo.boo: -------------------------------------------------------------------------------- 1 | import System.Reflection 2 | import 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("$projectname$")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("$projectname$")] 12 | [assembly: AssemblyCopyright("Copyright $registeredorganization$ $time$")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // This sets the default COM visibility of types in the assembly to invisible. 17 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The assembly version has following format : 21 | // 22 | // Major.Minor.Build.Revision 23 | // 24 | // You can specify all values by your own or you can build default build and revision 25 | // numbers with the '*' character (the default): 26 | 27 | [assembly: AssemblyVersion("1.0.*")] 28 | -------------------------------------------------------------------------------- /MPFProject/WebProjectBase.Files: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ProjectBase\Web\CodeBehindCodeGenerator.cs 12 | true 13 | 14 | 15 | ProjectBase\Web\FieldData.cs 16 | true 17 | 18 | 19 | ProjectBase\Web\LockedDocData.cs 20 | true 21 | 22 | 23 | ProjectBase\Web\VsHierarchyItem.cs 24 | true 25 | 26 | 27 | ProjectBase\Web\WAUtilities.cs 28 | true 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedTypeDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class MappedTypeDefinition : MappedNode 21 | { 22 | public TypeDefinition TypeNode { get; private set; } 23 | 24 | public MappedTypeDefinition(CompileResults results, TypeDefinition node) 25 | : base(results, node) 26 | { 27 | TypeNode = node; 28 | } 29 | 30 | public override MappedNodeType Type 31 | { 32 | get { return MappedNodeType.TypeDefiniton; } 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /VSPackage/Constants.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | 18 | namespace Hill30.BooProject 19 | { 20 | static class Constants 21 | { 22 | public const string LanguageName = "Visual Boo"; 23 | 24 | public const string GuidBooProjectPkgString = "3ed37b82-3194-4ca8-96b4-d4e3feb8a35d"; 25 | public const string GuidBooProjectCmdSetString = "ec06ff5c-8707-4572-9d77-348e88d3eebf"; 26 | 27 | public static readonly Guid GuidBooProjectCmdSet = new Guid(GuidBooProjectCmdSetString); 28 | }; 29 | 30 | public static class PkgCmdIDList 31 | { 32 | public const uint cmdidBooISh = 0x100; 33 | }; 34 | } -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Application/Application.booproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Debug 4 | Exe 5 | $safeprojectname$ 6 | $safeprojectname$ 7 | v3.5 8 | 9 | 10 | bin\Debug\ 11 | True 12 | Full 13 | False 14 | DEBUG;TRACE 15 | 16 | 17 | bin\Release\ 18 | False 19 | None 20 | True 21 | TRACE 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /VSPackage/Templates/Projects/Boo Library/Library.booproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | Library 6 | $safeprojectname$ 7 | $safeprojectname$ 8 | v3.5 9 | 10 | 11 | bin\Debug\ 12 | True 13 | Full 14 | False 15 | DEBUG;TRACE 16 | 17 | 18 | bin\Release\ 19 | False 20 | None 21 | True 22 | TRACE 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedTypeMemberDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class MappedTypeMemberDefinition : MappedNode 21 | { 22 | public MappedTypeMemberDefinition(CompileResults results, TypeMember node) 23 | : base(results, node) 24 | { 25 | } 26 | 27 | public MappedTypeMemberDefinition(CompileResults results, Field node) 28 | : base(results, node, node.Name.Length) 29 | { 30 | } 31 | 32 | public override MappedNodeType Type 33 | { 34 | get { return MappedNodeType.TypeMemberDefinition; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedVariableDefinition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class MappedVariableDefinition : MappedNode 21 | { 22 | 23 | public MappedVariableDefinition(CompileResults results, ParameterDeclaration node) 24 | : base(results, node, node.Name.Length) 25 | { 26 | } 27 | 28 | public MappedVariableDefinition(CompileResults results, Local node) 29 | : base(results, node, node.Name.Length) 30 | { 31 | } 32 | 33 | public override MappedNodeType Type 34 | { 35 | get { return MappedNodeType.VariableDefinition; } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MPFProject/ProjectNode.Events.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | 14 | namespace Microsoft.VisualStudio.Project 15 | { 16 | public partial class ProjectNode 17 | { 18 | #region fields 19 | private EventHandler projectPropertiesListeners; 20 | #endregion 21 | 22 | #region events 23 | public event EventHandler OnProjectPropertyChanged 24 | { 25 | add { projectPropertiesListeners += value; } 26 | remove { projectPropertiesListeners -= value; } 27 | } 28 | #endregion 29 | 30 | #region methods 31 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] 32 | protected void RaiseProjectPropertyChanged(string propertyName, string oldValue, string newValue) 33 | { 34 | if(null != projectPropertiesListeners) 35 | { 36 | projectPropertiesListeners(this, new ProjectPropertyChangedArgs(propertyName, oldValue, newValue)); 37 | } 38 | } 39 | #endregion 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /MapperTests/MiscellaneousTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Boo.Lang.Compiler.Ast; 3 | using Hill30.Boo.ASTMapper; 4 | using Hill30.Boo.ASTMapper.AST.Nodes; 5 | using NUnit.Framework; 6 | using Microsoft.VisualStudio.TextManager.Interop; 7 | using Microsoft.VisualStudio.Package; 8 | 9 | namespace MapperTests 10 | { 11 | 12 | [TestFixture] 13 | public class MiscellaneousTests : TestBase 14 | { 15 | [Test] 16 | public void MacroReference() 17 | { 18 | RunTest( 19 | new TestData 20 | { 21 | source = "a=1\nprint a", 22 | location = new SourceLocation(2, 1), 23 | expectedDatatip = "macro print", 24 | expectedSpan = new TextSpan { iStartLine = 1, iEndLine = 1, iStartIndex = 0, iEndIndex = 5 } 25 | } 26 | ); 27 | } 28 | 29 | 30 | // TODO: Test the comments mapping 31 | // [Test] 32 | // public void Comments() 33 | // { 34 | // var results = RunCompiler( 35 | // @"// A comment. 36 | // /* A possibly multiline 37 | // comment. */ 38 | // # Another comment" 39 | // ); 40 | 41 | // var mToken = results.GetMappedToken(0, 3); 42 | // Assert.Null(mToken); 43 | 44 | // results.GetMappedToken(1, 3); 45 | // Assert.Null(mToken); 46 | 47 | // results.GetMappedToken(2, 2); 48 | // Assert.Null(mToken); 49 | // } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSPackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Visual Boo 5 | Hill30 6 | 0.6.0.0 7 | Allows using Visual Studio as an IDE for programming in Boo. 8 | 9 | 1033 10 | http://boo.codehaus.org/ 11 | boo.ico 12 | BooLogo.png 13 | false 14 | 15 | 16 | Ultimate 17 | Premium 18 | Pro 19 | 20 | 21 | 22 | 23 | 24 | 25 | Visual Studio MPF 26 | 27 | 28 | 29 | |%CurrentProject%;PkgdefProjectOutputGroup| 30 | |%CurrentProject%| 31 | ProjectTemplates 32 | ItemTemplates 33 | 34 | 35 | -------------------------------------------------------------------------------- /VSPackage/LanguageService/Colorizer/ClassifierProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.ComponentModel.Composition; 21 | using Microsoft.VisualStudio.Text.Classification; 22 | using Microsoft.VisualStudio.TextManager.Interop; 23 | using Microsoft.VisualStudio.Utilities; 24 | using Microsoft.VisualStudio.Text; 25 | using Microsoft.VisualStudio.Editor; 26 | using Microsoft.VisualStudio.Shell; 27 | 28 | namespace Hill30.BooProject.LanguageService.Colorizer 29 | { 30 | [Export(typeof(IClassifierProvider))] 31 | [ContentType("Visual Boo")] 32 | [Name("Boo Classifier")] 33 | internal class ClassifierProvider : IClassifierProvider 34 | { 35 | public IClassifier GetClassifier(ITextBuffer textBuffer) 36 | { 37 | return new Classifier(textBuffer); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /VSPackage/LanguageService/Colorizer/TaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using Microsoft.VisualStudio.Text.Tagging; 21 | using System.ComponentModel.Composition; 22 | using Microsoft.VisualStudio.Utilities; 23 | using Microsoft.VisualStudio.Editor; 24 | using Microsoft.VisualStudio.Shell; 25 | using Microsoft.VisualStudio.TextManager.Interop; 26 | using Microsoft.VisualStudio.Text; 27 | 28 | namespace Hill30.BooProject.LanguageService.Colorizer 29 | { 30 | [Export(typeof(ITaggerProvider))] 31 | [ContentType("Visual Boo")] 32 | [TagType(typeof(ErrorTag))] 33 | public class TaggerProvider : ITaggerProvider 34 | { 35 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 36 | { 37 | return (ITagger)new Tagger(buffer); 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ASTMapper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ASTMapper")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ASTMapper")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("40700958-213d-46af-a454-f1a42b09fd61")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /BoocNET35/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BoocNET35")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("BoocNET35")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("80a23ae7-4382-4ecd-a4ed-240637639029")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /BoocNET40/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BoocNET35")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("BoocNET35")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("80a23ae7-4382-4ecd-a4ed-240637639029")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MapperTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MapperTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("MapperTests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cb3a4908-b446-4d3e-a225-5d30e6136972")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MSBuildUtilities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MSBuildUtilities")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("MSBuildUtilities")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("df97851c-f824-416f-8949-057b518da202")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MPFProject/Automation/OAFolderItem.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Runtime.InteropServices; 15 | using EnvDTE; 16 | 17 | namespace Microsoft.VisualStudio.Project.Automation 18 | { 19 | /// 20 | /// Represents an automation object for a folder in a project 21 | /// 22 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 23 | [ComVisible(true), CLSCompliant(false)] 24 | public class OAFolderItem : OAProjectItem 25 | { 26 | #region ctors 27 | public OAFolderItem(OAProject project, FolderNode node) 28 | : base(project, node) 29 | { 30 | } 31 | 32 | #endregion 33 | 34 | #region overridden methods 35 | public override ProjectItems Collection 36 | { 37 | get 38 | { 39 | ProjectItems items = new OAProjectItems(this.Project, this.Node); 40 | return items; 41 | } 42 | } 43 | 44 | public override ProjectItems ProjectItems 45 | { 46 | get 47 | { 48 | return this.Collection; 49 | } 50 | } 51 | #endregion 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedMacroReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | 18 | namespace Hill30.Boo.ASTMapper.AST.Nodes 19 | { 20 | public class MappedMacroReference : MappedNode 21 | { 22 | 23 | private readonly string format; 24 | private readonly string quickInfoTip; 25 | 26 | public MappedMacroReference(CompileResults results, MacroStatement node) 27 | : base(results, node, node.Name.Length) 28 | { 29 | format = Formats.BooMacro; 30 | quickInfoTip = "macro " + node.Name; 31 | } 32 | 33 | public override MappedNodeType Type 34 | { 35 | get { return MappedNodeType.MacroReference; } 36 | } 37 | 38 | public override string QuickInfoTip 39 | { 40 | get { return quickInfoTip; } 41 | } 42 | 43 | public override string Format 44 | { 45 | get { return format; } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MPFProject/Diagrams/DocumentManagerClasses.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | FileDocumentManager.cs 8 | AACAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 9 | 10 | 11 | 12 | 13 | 14 | DocumentManager.cs 15 | AQCAQIQAAAAAIAEAAAAAAAAAIAAAAAAAAAAAACGAAAE= 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ProjectDesignerDocumentManager.cs 28 | AACAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 29 | 30 | 31 | 32 | 33 | 34 | HierarchyNode.cs 35 | NKl4a26oCodRuoDQodAKZKQQxKtwgtmAOJLYAHLHccE= 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_IntegrationTests/SignOff-Tests/SolutionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using Microsoft.VSSDK.Tools.VsIdeTesting; 7 | using EnvDTE; 8 | using System.IO; 9 | using Microsoft.VsSDK.IntegrationTestLibrary; 10 | 11 | 12 | namespace BooProject_IntegrationTests.IntegrationTests 13 | { 14 | [TestClass] 15 | public class SolutionTests 16 | { 17 | #region fields 18 | private delegate void ThreadInvoker(); 19 | private TestContext _testContext; 20 | #endregion 21 | 22 | #region properties 23 | /// 24 | ///Gets or sets the test context which provides 25 | ///information about and functionality for the current test run. 26 | /// 27 | public TestContext TestContext 28 | { 29 | get { return _testContext; } 30 | set { _testContext = value; } 31 | } 32 | #endregion 33 | 34 | 35 | #region ctors 36 | public SolutionTests() 37 | { 38 | } 39 | 40 | #endregion 41 | 42 | [TestMethod] 43 | [HostType("VS IDE")] 44 | public void CreateEmptySolution() 45 | { 46 | UIThreadInvoker.Invoke((ThreadInvoker)delegate() 47 | { 48 | TestUtils testUtils = new TestUtils(); 49 | testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave); 50 | testUtils.CreateEmptySolution(TestContext.TestDir, "EmptySolution"); 51 | }); 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /VSPackage/Project/BooProjectFactory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.IO; 18 | using Microsoft.VisualStudio.Project; 19 | using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; 20 | 21 | namespace Hill30.BooProject.Project 22 | { 23 | public class BooProjectFactory : ProjectFactory 24 | { 25 | readonly BooProjectPackage package; 26 | public BooProjectFactory(BooProjectPackage package) 27 | : base(package) 28 | { 29 | if (Environment.GetEnvironmentVariable("BooBinPath", EnvironmentVariableTarget.User) == null) 30 | BuildEngine.SetGlobalProperty("BooBinPath", GlobalServices.BinPath); 31 | this.package = package; 32 | } 33 | 34 | protected override ProjectNode CreateProject() 35 | { 36 | var result = new BooProjectNode(); 37 | result.SetSite((IOleServiceProvider)((IServiceProvider)package).GetService(typeof(IOleServiceProvider))); 38 | return result; 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /VSPackage/BooISh/Window.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | 3 | namespace Hill30.BooProject.BooISh 4 | { 5 | /// 6 | /// This class implements the tool window exposed by this package and hosts a user control. 7 | /// 8 | /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane, 9 | /// usually implemented by the package implementer. 10 | /// 11 | /// This class derives from the ToolWindowPane class provided from the MPF in order to use its 12 | /// implementation of the IVsUIElementPane interface. 13 | /// 14 | public class Window : ToolWindowPane 15 | { 16 | /// 17 | /// Standard constructor for the tool window. 18 | /// 19 | public Window() : 20 | base(null) 21 | { 22 | // Set the window title reading it from the resources. 23 | Caption = Resources.GetString(Resources.ToolWindowTitle); 24 | // Set the image that will appear on the tab of the window frame 25 | // when docked with an other window 26 | // The resource ID correspond to the one defined in the resx file 27 | // while the Index is the offset in the bitmap strip. Each image in 28 | // the strip being 16x16. 29 | BitmapResourceID = 301; 30 | BitmapIndex = 0; 31 | 32 | // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, 33 | // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on 34 | // the object returned by the Content property. 35 | base.Content = new Control(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ASTMapper/IFileNode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Runtime.InteropServices; 19 | using Hill30.Boo.ASTMapper.AST; 20 | using Hill30.Boo.ASTMapper.AST.Nodes; 21 | using Microsoft.VisualStudio.Text; 22 | using Microsoft.VisualStudio.Text.Classification; 23 | using Microsoft.VisualStudio.Text.Tagging; 24 | 25 | namespace Hill30.Boo.ASTMapper 26 | { 27 | [ComVisible(true)] 28 | public interface IFileNode 29 | { 30 | event EventHandler Recompiled; 31 | 32 | MappedToken GetMappedToken(int line, int col); 33 | 34 | MappedToken GetAdjacentMappedToken(int line, int col); 35 | 36 | IEnumerable Types { get; } 37 | 38 | CompileResults.BufferPoint MapPosition(int line, int column); 39 | 40 | IEnumerable> GetTags(NormalizedSnapshotSpanCollection spans); 41 | 42 | IList GetClassificationSpans(SnapshotSpan span); 43 | 44 | void HideMessages(); 45 | 46 | void ShowMessages(); 47 | 48 | void Bind(ITextBuffer textBuffer); 49 | 50 | void SubmitForCompile(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /VSPackage/BooISh/BooIShWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | 5 | namespace Hill30.BooProject.BooISh 6 | { 7 | public class BooIShWrapper 8 | { 9 | private readonly Process booInterpreter; 10 | private readonly Action recorder; 11 | public BooIShWrapper(Action recorder) 12 | { 13 | this.recorder = recorder; 14 | booInterpreter = 15 | new Process 16 | { 17 | StartInfo = 18 | { 19 | UseShellExecute = false, 20 | FileName = 21 | GlobalServices.BinPath + @"\booish.exe", 22 | CreateNoWindow = true, 23 | RedirectStandardOutput = true, 24 | RedirectStandardError = true, 25 | RedirectStandardInput = true, 26 | WindowStyle = ProcessWindowStyle.Hidden 27 | } 28 | }; 29 | booInterpreter.OutputDataReceived += booInterpreter_OutputDataReceived; 30 | booInterpreter.ErrorDataReceived += booInterpreter_OutputDataReceived; 31 | booInterpreter.EnableRaisingEvents = true; 32 | booInterpreter.Start(); 33 | booInterpreter.BeginOutputReadLine(); 34 | booInterpreter.BeginErrorReadLine(); 35 | } 36 | 37 | private void booInterpreter_OutputDataReceived(object sender, DataReceivedEventArgs e) 38 | { 39 | recorder(e.Data + "\n"); 40 | } 41 | 42 | public StreamWriter Input { get { return booInterpreter.StandardInput; } } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /VSPackage/BooISh/BooIShControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Input; 5 | using UserControl = System.Windows.Controls.UserControl; 6 | 7 | namespace Hill30.BooProject.BooISh 8 | { 9 | /// 10 | /// Interaction logic for MyControl.xaml 11 | /// 12 | public partial class Control : UserControl 13 | { 14 | public Control() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private BooIShWrapper booIShWrapper; 20 | private void BooIShScreen_Loaded(object sender, RoutedEventArgs e) 21 | { 22 | TextBox textBox = BooIShScreen; 23 | booIShWrapper = 24 | new BooIShWrapper( 25 | s => textBox.Dispatcher.BeginInvoke( 26 | new Action( 27 | () => 28 | { 29 | textBox.AppendText(s); 30 | caretIndex = textBox.Text.Length - 1; 31 | } 32 | ))); 33 | } 34 | 35 | private int caretIndex; 36 | 37 | private void BooIShScreen_KeyDown(object sender, KeyEventArgs e) 38 | { 39 | if (e.Key == Key.Return) 40 | { 41 | caretIndex = BooIShScreen.CaretIndex+1; 42 | booIShWrapper.Input.WriteLine(BooIShScreen.Text.Substring(caretIndex)); 43 | BooIShScreen.AppendText("\n"); 44 | } 45 | 46 | if (BooIShScreen.CaretIndex < caretIndex) 47 | BooIShScreen.CaretIndex = BooIShScreen.Text.Length - 1; 48 | } 49 | 50 | private void BooIShScreen_Unloaded(object sender, RoutedEventArgs e) 51 | { 52 | 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /MPFProject/ConfigurationProperties.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | 15 | namespace Microsoft.VisualStudio.Project 16 | { 17 | /// 18 | /// Defines the config dependent properties exposed through automation 19 | /// 20 | [ComVisible(true)] 21 | [Guid("21f73a8f-91d7-4085-9d4f-c48ee235ee5b")] 22 | public interface IProjectConfigProperties 23 | { 24 | string OutputPath { get; set; } 25 | } 26 | 27 | /// 28 | /// Implements the configuration dependent properties interface 29 | /// 30 | [CLSCompliant(false), ComVisible(true)] 31 | [ClassInterface(ClassInterfaceType.None)] 32 | public class ProjectConfigProperties : IProjectConfigProperties 33 | { 34 | #region fields 35 | private ProjectConfig projectConfig; 36 | #endregion 37 | 38 | #region ctors 39 | public ProjectConfigProperties(ProjectConfig projectConfig) 40 | { 41 | this.projectConfig = projectConfig; 42 | } 43 | #endregion 44 | 45 | #region IProjectConfigProperties Members 46 | 47 | public virtual string OutputPath 48 | { 49 | get 50 | { 51 | return this.projectConfig.GetConfigurationProperty(BuildPropertyPageTag.OutputPath.ToString(), true); 52 | } 53 | set 54 | { 55 | this.projectConfig.SetConfigurationProperty(BuildPropertyPageTag.OutputPath.ToString(), value); 56 | } 57 | } 58 | 59 | #endregion 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_IntegrationTests/PackageTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using Microsoft.VSSDK.Tools.VsIdeTesting; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using Microsoft.VisualStudio.Shell; 9 | using EnvDTE; 10 | 11 | namespace BooProject_IntegrationTests 12 | { 13 | /// 14 | /// Integration test for package validation 15 | /// 16 | [TestClass] 17 | public class PackageTest 18 | { 19 | private delegate void ThreadInvoker(); 20 | 21 | private TestContext testContextInstance; 22 | 23 | /// 24 | ///Gets or sets the test context which provides 25 | ///information about and functionality for the current test run. 26 | /// 27 | public TestContext TestContext 28 | { 29 | get 30 | { 31 | return testContextInstance; 32 | } 33 | set 34 | { 35 | testContextInstance = value; 36 | } 37 | } 38 | 39 | [TestMethod] 40 | [HostType("VS IDE")] 41 | public void PackageLoadTest() 42 | { 43 | UIThreadInvoker.Invoke((ThreadInvoker)delegate() 44 | { 45 | 46 | //Get the Shell Service 47 | IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; 48 | Assert.IsNotNull(shellService); 49 | 50 | //Validate package load 51 | IVsPackage package; 52 | Guid packageGuid = new Guid(Hill30.BooProject.Constants.GuidBooProjectPkgString); 53 | Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); 54 | Assert.IsNotNull(package, "Package failed to load"); 55 | 56 | }); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /VSPackage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Resources; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("BooProject")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Hill30")] 14 | [assembly: AssemblyProduct("BooProject")] 15 | [assembly: AssemblyCopyright("")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | [assembly: ComVisible(false)] 19 | [assembly: CLSCompliant(false)] 20 | [assembly: NeutralResourcesLanguage("en-US")] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Revision and Build Numbers 30 | // by using the '*' as shown below: 31 | 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | 35 | [assembly: InternalsVisibleTo("BooProject_IntegrationTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001125f975fab37e7cff70c520c9fb8bfc8d7489d5bfa423820a164623af7c5d18d77f6dc83e8731a33284c125b4268d6bcc8f464718d9b92b7ac3a57bfce95c99509dc95cb366ffde14781d2dcfccf8e62ce22af9494bd21021deb36eb5ec8d1450dc3f197ac86a8c8d1c12ef99bdfd822d317f31b32eef00fcac9515c49091d3")] 36 | [assembly: InternalsVisibleTo("BooProject_UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001125f975fab37e7cff70c520c9fb8bfc8d7489d5bfa423820a164623af7c5d18d77f6dc83e8731a33284c125b4268d6bcc8f464718d9b92b7ac3a57bfce95c99509dc95cb366ffde14781d2dcfccf8e62ce22af9494bd21021deb36eb5ec8d1450dc3f197ac86a8c8d1c12ef99bdfd822d317f31b32eef00fcac9515c49091d3")] 37 | -------------------------------------------------------------------------------- /VSPackage/LanguageService/Colorizer/Tagger.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using Hill30.Boo.ASTMapper; 19 | using Microsoft.VisualStudio.Text; 20 | using Microsoft.VisualStudio.Text.Tagging; 21 | 22 | namespace Hill30.BooProject.LanguageService.Colorizer 23 | { 24 | class Tagger : ITagger 25 | { 26 | private ITextBuffer buffer; 27 | private IFileNode fileNode; 28 | 29 | public Tagger(ITextBuffer buffer) 30 | { 31 | this.buffer = buffer; 32 | fileNode = GlobalServices.GetFileNodeForBuffer(buffer); 33 | if (fileNode != null) 34 | fileNode.Recompiled += SourceRecompiled; 35 | } 36 | 37 | #region ITagger Members 38 | 39 | public IEnumerable> GetTags(NormalizedSnapshotSpanCollection spans) 40 | { 41 | if (fileNode != null) 42 | return fileNode.GetTags(spans); 43 | return new List>(); 44 | } 45 | 46 | public event EventHandler TagsChanged; 47 | 48 | #endregion 49 | 50 | void SourceRecompiled(object sender, EventArgs e) 51 | { 52 | if (TagsChanged != null) 53 | TagsChanged(sender, new SnapshotSpanEventArgs(new SnapshotSpan(buffer.CurrentSnapshot, 0, buffer.CurrentSnapshot.Length))); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Boo.Lang.Compiler.Ast; 17 | using Boo.Lang.Compiler.TypeSystem; 18 | 19 | namespace Hill30.Boo.ASTMapper.AST.Nodes 20 | { 21 | public class MappedAttribute : MappedNode 22 | { 23 | private string quickInfoTip; 24 | private string format; 25 | 26 | public MappedAttribute(CompileResults results, Attribute node) 27 | : base(results, node, node.Name.Length) 28 | { 29 | } 30 | 31 | public override string Format 32 | { 33 | get { return format; } 34 | } 35 | 36 | public override string QuickInfoTip 37 | { 38 | get { return quickInfoTip; } 39 | } 40 | 41 | public override MappedNodeType Type 42 | { 43 | get { return MappedNodeType.TypeReference; } 44 | } 45 | 46 | protected override void ResolveImpl(MappedToken token) 47 | { 48 | try 49 | { 50 | var type = TypeSystemServices.GetType(Node); 51 | if (type is Error) 52 | return; 53 | var a = Node as Attribute; 54 | if (a == null) 55 | return; 56 | quickInfoTip = "class " + a.Name; 57 | format = Formats.BooType; 58 | } 59 | catch 60 | { 61 | return; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_UnitTests/PackageTest.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections; 14 | using System.Text; 15 | using System.Reflection; 16 | using Microsoft.VsSDK.UnitTestLibrary; 17 | using Microsoft.VisualStudio.Shell.Interop; 18 | using Microsoft.VisualStudio.TestTools.UnitTesting; 19 | using Hill30.BooProject; 20 | 21 | namespace BooProject_UnitTests 22 | { 23 | [TestClass()] 24 | public class PackageTest 25 | { 26 | [TestMethod()] 27 | public void CreateInstance() 28 | { 29 | BooProjectPackage package = new BooProjectPackage(); 30 | } 31 | 32 | [TestMethod()] 33 | public void IsIVsPackage() 34 | { 35 | BooProjectPackage package = new BooProjectPackage(); 36 | Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage"); 37 | } 38 | 39 | [TestMethod()] 40 | public void SetSite() 41 | { 42 | // Create the package 43 | IVsPackage package = new BooProjectPackage() as IVsPackage; 44 | Assert.IsNotNull(package, "The object does not implement IVsPackage"); 45 | 46 | // Create a basic service provider 47 | OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices(); 48 | 49 | // Site the package 50 | Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK"); 51 | 52 | // Unsite the package 53 | Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK"); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MPFProject/PropertiesEditorLauncher.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.ComponentModel; 14 | using Microsoft.VisualStudio.Shell; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | using ErrorHandler = Microsoft.VisualStudio.ErrorHandler; 17 | 18 | namespace Microsoft.VisualStudio.Project 19 | { 20 | /// 21 | /// This class is used to enable launching the project properties 22 | /// editor from the Properties Browser. 23 | /// 24 | [CLSCompliant(false)] 25 | public class PropertiesEditorLauncher : ComponentEditor 26 | { 27 | private ServiceProvider serviceProvider; 28 | 29 | #region ctor 30 | public PropertiesEditorLauncher(ServiceProvider serviceProvider) 31 | { 32 | if(serviceProvider == null) 33 | throw new ArgumentNullException("serviceProvider"); 34 | 35 | this.serviceProvider = serviceProvider; 36 | } 37 | #endregion 38 | #region overridden methods 39 | /// 40 | /// Launch the Project Properties Editor (properties pages) 41 | /// 42 | /// If we succeeded or not 43 | public override bool EditComponent(ITypeDescriptorContext context, object component) 44 | { 45 | if(component is ProjectNodeProperties) 46 | { 47 | IVsPropertyPageFrame propertyPageFrame = (IVsPropertyPageFrame)serviceProvider.GetService((typeof(SVsPropertyPageFrame))); 48 | 49 | int hr = propertyPageFrame.ShowFrame(Guid.Empty); 50 | if(ErrorHandler.Succeeded(hr)) 51 | return true; 52 | else 53 | ErrorHandler.ThrowOnFailure(propertyPageFrame.ReportError(hr)); 54 | } 55 | 56 | return false; 57 | } 58 | #endregion 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MPFProject/Automation/OAReferenceFolderItem.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Diagnostics.CodeAnalysis; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace Microsoft.VisualStudio.Project.Automation 18 | { 19 | /// 20 | /// Contains OAReferenceItem objects 21 | /// 22 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 23 | [ComVisible(true), CLSCompliant(false)] 24 | public class OAReferenceFolderItem : OAProjectItem 25 | { 26 | #region ctors 27 | public OAReferenceFolderItem(OAProject project, ReferenceContainerNode node) 28 | : base(project, node) 29 | { 30 | } 31 | 32 | #endregion 33 | 34 | #region overridden methods 35 | /// 36 | /// Returns the project items collection of all the references defined for this project. 37 | /// 38 | public override EnvDTE.ProjectItems ProjectItems 39 | { 40 | get 41 | { 42 | return new OANavigableProjectItems(this.Project, this.GetListOfProjectItems(), this.Node); 43 | } 44 | } 45 | 46 | 47 | #endregion 48 | 49 | #region Helper methods 50 | private List GetListOfProjectItems() 51 | { 52 | List list = new List(); 53 | for(HierarchyNode child = this.Node.FirstChild; child != null; child = child.NextSibling) 54 | { 55 | ReferenceNode node = child as ReferenceNode; 56 | 57 | if(node != null) 58 | { 59 | list.Add(new OAReferenceItem(this.Project, node)); 60 | } 61 | } 62 | 63 | return list; 64 | } 65 | #endregion 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /MPFProject/Automation/VSProject/OAVSProjectItem.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Runtime.InteropServices; 15 | using EnvDTE; 16 | using VSLangProj; 17 | 18 | namespace Microsoft.VisualStudio.Project.Automation 19 | { 20 | /// 21 | /// Represents a language-specific project item 22 | /// 23 | [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "OAVS")] 24 | [ComVisible(true), CLSCompliant(false)] 25 | public class OAVSProjectItem : VSProjectItem 26 | { 27 | #region fields 28 | private FileNode fileNode; 29 | #endregion 30 | 31 | #region ctors 32 | public OAVSProjectItem(FileNode fileNode) 33 | { 34 | this.FileNode = fileNode; 35 | } 36 | #endregion 37 | 38 | #region VSProjectItem Members 39 | 40 | public virtual EnvDTE.Project ContainingProject 41 | { 42 | get { return fileNode.ProjectMgr.GetAutomationObject() as EnvDTE.Project; } 43 | } 44 | 45 | public virtual ProjectItem ProjectItem 46 | { 47 | get { return fileNode.GetAutomationObject() as ProjectItem; } 48 | } 49 | 50 | public virtual DTE DTE 51 | { 52 | get { return (DTE)this.fileNode.ProjectMgr.Site.GetService(typeof(DTE)); } 53 | } 54 | 55 | public virtual void RunCustomTool() 56 | { 57 | this.FileNode.RunGenerator(); 58 | } 59 | 60 | #endregion 61 | 62 | #region public properties 63 | /// 64 | /// File Node property 65 | /// 66 | public FileNode FileNode 67 | { 68 | get 69 | { 70 | return fileNode; 71 | } 72 | set 73 | { 74 | fileNode = value; 75 | } 76 | } 77 | #endregion 78 | 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /VSPackage/LanguageService/Colorizer/Classifier.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using Hill30.Boo.ASTMapper; 19 | using Microsoft.VisualStudio.Text; 20 | using Microsoft.VisualStudio.Text.Classification; 21 | 22 | namespace Hill30.BooProject.LanguageService.Colorizer 23 | { 24 | class Classifier : IClassifier 25 | { 26 | private ITextBuffer buffer; 27 | private IFileNode fileNode; 28 | 29 | public Classifier(ITextBuffer buffer) 30 | { 31 | this.buffer = buffer; 32 | fileNode = GlobalServices.GetFileNodeForBuffer(buffer); 33 | if (fileNode != null) 34 | fileNode.Recompiled += SourceRecompiled; 35 | } 36 | 37 | #region IClassifier Members 38 | 39 | public event EventHandler ClassificationChanged; 40 | 41 | public IList GetClassificationSpans(SnapshotSpan span) 42 | { 43 | 44 | if (fileNode != null) 45 | return fileNode.GetClassificationSpans(span); 46 | 47 | return new List(); 48 | } 49 | 50 | #endregion 51 | 52 | void SourceRecompiled(object sender, EventArgs e) 53 | { 54 | if (ClassificationChanged != null) 55 | ClassificationChanged(sender, new ClassificationChangedEventArgs(new SnapshotSpan(buffer.CurrentSnapshot, 0, buffer.CurrentSnapshot.Length))); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /MPFProject/Automation/OANestedProjectItem.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Runtime.InteropServices; 15 | using Microsoft.VisualStudio; 16 | using Microsoft.VisualStudio.Shell.Interop; 17 | 18 | namespace Microsoft.VisualStudio.Project.Automation 19 | { 20 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 21 | [ComVisible(true), CLSCompliant(false)] 22 | public class OANestedProjectItem : OAProjectItem 23 | { 24 | #region fields 25 | EnvDTE.Project nestedProject; 26 | #endregion 27 | 28 | #region ctors 29 | public OANestedProjectItem(OAProject project, NestedProjectNode node) 30 | : base(project, node) 31 | { 32 | if (node == null) 33 | { 34 | throw new ArgumentNullException("node"); 35 | } 36 | 37 | object nestedproject; 38 | if(ErrorHandler.Succeeded(node.NestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out nestedproject))) 39 | { 40 | this.nestedProject = nestedproject as EnvDTE.Project; 41 | } 42 | } 43 | 44 | #endregion 45 | 46 | #region overridden methods 47 | /// 48 | /// Returns the collection of project items defined in the nested project 49 | /// 50 | public override EnvDTE.ProjectItems ProjectItems 51 | { 52 | get 53 | { 54 | if(this.nestedProject != null) 55 | { 56 | return this.nestedProject.ProjectItems; 57 | } 58 | return null; 59 | } 60 | } 61 | 62 | /// 63 | /// Returns the nested project. 64 | /// 65 | public override EnvDTE.Project SubProject 66 | { 67 | get 68 | { 69 | return this.nestedProject; 70 | } 71 | } 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_IntegrationTests/MenuItemTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.ComponentModel.Design; 4 | using Hill30.BooProject; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using Microsoft.VisualStudio.OLE.Interop; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using Microsoft.VisualStudio.Shell; 9 | using Microsoft.VsSDK.IntegrationTestLibrary; 10 | using Microsoft.VSSDK.Tools.VsIdeTesting; 11 | 12 | namespace BooProject_IntegrationTests 13 | { 14 | [TestClass()] 15 | public class MenuItemTest 16 | { 17 | private delegate void ThreadInvoker(); 18 | 19 | private TestContext testContextInstance; 20 | 21 | /// 22 | ///Gets or sets the test context which provides 23 | ///information about and functionality for the current test run. 24 | /// 25 | public TestContext TestContext 26 | { 27 | get 28 | { 29 | return testContextInstance; 30 | } 31 | set 32 | { 33 | testContextInstance = value; 34 | } 35 | } 36 | 37 | /// 38 | ///A test for lauching the command and closing the associated dialogbox 39 | /// 40 | [TestMethod()] 41 | [HostType("VS IDE")] 42 | public void LaunchCommand() 43 | { 44 | UIThreadInvoker.Invoke((ThreadInvoker)delegate() 45 | { 46 | CommandID menuItemCmd = new CommandID(Hill30.BooProject.Constants.GuidBooProjectCmdSet, (int)PkgCmdIDList.cmdidBooISh); 47 | 48 | // Create the DialogBoxListener Thread. 49 | string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "BooProject", "Hill30.BooProject.BooProjectPackage"); 50 | DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText); 51 | 52 | try 53 | { 54 | purger.Start(); 55 | 56 | TestUtils testUtils = new TestUtils(); 57 | testUtils.ExecuteCommand(menuItemCmd); 58 | } 59 | finally 60 | { 61 | Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown"); 62 | } 63 | }); 64 | } 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /MPFProject/NestedProjectBuildDependency.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio; 14 | using Microsoft.VisualStudio.Shell.Interop; 15 | 16 | namespace Microsoft.VisualStudio.Project 17 | { 18 | /// 19 | /// Used for adding a build dependency to nested project (not a real project reference) 20 | /// 21 | public class NestedProjectBuildDependency : IVsBuildDependency 22 | { 23 | IVsHierarchy dependentHierarchy = null; 24 | 25 | #region ctors 26 | [CLSCompliant(false)] 27 | public NestedProjectBuildDependency(IVsHierarchy dependentHierarchy) 28 | { 29 | this.dependentHierarchy = dependentHierarchy; 30 | } 31 | #endregion 32 | 33 | #region IVsBuildDependency methods 34 | public int get_CanonicalName(out string canonicalName) 35 | { 36 | canonicalName = null; 37 | return VSConstants.S_OK; 38 | } 39 | 40 | public int get_Type(out System.Guid guidType) 41 | { 42 | // All our dependencies are build projects 43 | guidType = VSConstants.GUID_VS_DEPTYPE_BUILD_PROJECT; 44 | 45 | return VSConstants.S_OK; 46 | } 47 | 48 | public int get_Description(out string description) 49 | { 50 | description = null; 51 | return VSConstants.S_OK; 52 | } 53 | 54 | [CLSCompliant(false)] 55 | public int get_HelpContext(out uint helpContext) 56 | { 57 | helpContext = 0; 58 | return VSConstants.E_NOTIMPL; 59 | } 60 | 61 | public int get_HelpFile(out string helpFile) 62 | { 63 | helpFile = null; 64 | return VSConstants.E_NOTIMPL; 65 | } 66 | 67 | public int get_MustUpdateBefore(out int mustUpdateBefore) 68 | { 69 | // Must always update dependencies 70 | mustUpdateBefore = 1; 71 | 72 | return VSConstants.S_OK; 73 | } 74 | 75 | public int get_ReferredProject(out object unknownProject) 76 | { 77 | unknownProject = this.dependentHierarchy; 78 | 79 | return (unknownProject == null) ? VSConstants.E_FAIL : VSConstants.S_OK; 80 | } 81 | #endregion 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /MPFProject/Tracing.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System.Diagnostics; 13 | 14 | namespace Microsoft.VisualStudio.Project 15 | { 16 | internal class CCITracing 17 | { 18 | private CCITracing() { } 19 | 20 | [ConditionalAttribute("Enable_CCIDiagnostics")] 21 | static void InternalTraceCall(int levels) 22 | { 23 | System.Diagnostics.StackFrame stack; 24 | stack = new System.Diagnostics.StackFrame(levels); 25 | System.Reflection.MethodBase method = stack.GetMethod(); 26 | if(method != null) 27 | { 28 | string name = method.Name + " \tin class " + method.DeclaringType.Name; 29 | System.Diagnostics.Trace.WriteLine("Call Trace: \t" + name); 30 | } 31 | } 32 | 33 | [ConditionalAttribute("CCI_TRACING")] 34 | static public void TraceCall() 35 | { 36 | // skip this one as well 37 | CCITracing.InternalTraceCall(2); 38 | } 39 | 40 | [ConditionalAttribute("CCI_TRACING")] 41 | static public void TraceCall(string strParameters) 42 | { 43 | CCITracing.InternalTraceCall(2); 44 | System.Diagnostics.Trace.WriteLine("\tParameters: \t" + strParameters); 45 | } 46 | 47 | [ConditionalAttribute("CCI_TRACING")] 48 | static public void Trace(System.Exception e) 49 | { 50 | CCITracing.InternalTraceCall(2); 51 | System.Diagnostics.Trace.WriteLine("ExceptionInfo: \t" + e.ToString()); 52 | } 53 | 54 | [ConditionalAttribute("CCI_TRACING")] 55 | static public void Trace(string strOutput) 56 | { 57 | System.Diagnostics.Trace.WriteLine(strOutput); 58 | } 59 | 60 | [ConditionalAttribute("CCI_TRACING")] 61 | static public void TraceData(string strOutput) 62 | { 63 | System.Diagnostics.Trace.WriteLine("Data Trace: \t" + strOutput); 64 | } 65 | 66 | [ConditionalAttribute("Enable_CCIFileOutput")] 67 | [ConditionalAttribute("CCI_TRACING")] 68 | static public void AddTraceLog(string strFileName) 69 | { 70 | TextWriterTraceListener tw = new TextWriterTraceListener("c:\\mytrace.log"); 71 | System.Diagnostics.Trace.Listeners.Add(tw); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /MPFProject/VSShellUtilities.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using Microsoft.VisualStudio; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | /// 20 | ///This class provides some useful static shell based methods. 21 | /// 22 | [CLSCompliant(false)] 23 | public static class UIHierarchyUtilities 24 | { 25 | /// 26 | /// Get reference to IVsUIHierarchyWindow interface from guid persistence slot. 27 | /// 28 | /// The service provider. 29 | /// Unique identifier for a tool window created using IVsUIShell::CreateToolWindow. 30 | /// The caller of this method can use predefined identifiers that map to tool windows if those tool windows 31 | /// are known to the caller. 32 | /// A reference to an IVsUIHierarchyWindow interface. 33 | public static IVsUIHierarchyWindow GetUIHierarchyWindow(IServiceProvider serviceProvider, Guid persistenceSlot) 34 | { 35 | if(serviceProvider == null) 36 | { 37 | throw new ArgumentNullException("serviceProvider"); 38 | } 39 | 40 | IVsUIShell shell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; 41 | 42 | Debug.Assert(shell != null, "Could not get the ui shell from the project"); 43 | if(shell == null) 44 | { 45 | throw new InvalidOperationException(); 46 | } 47 | 48 | object pvar = null; 49 | IVsWindowFrame frame = null; 50 | IVsUIHierarchyWindow uiHierarchyWindow = null; 51 | 52 | try 53 | { 54 | ErrorHandler.ThrowOnFailure(shell.FindToolWindow(0, ref persistenceSlot, out frame)); 55 | ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar)); 56 | } 57 | finally 58 | { 59 | if(pvar != null) 60 | { 61 | uiHierarchyWindow = (IVsUIHierarchyWindow)pvar; 62 | } 63 | } 64 | 65 | return uiHierarchyWindow; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /MPFProject/Automation/VSProject/OAComReference.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Globalization; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace Microsoft.VisualStudio.Project.Automation 18 | { 19 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 20 | [ComVisible(true)] 21 | public class OAComReference : OAReferenceBase 22 | { 23 | public OAComReference(ComReferenceNode comReference) : 24 | base(comReference) 25 | { 26 | } 27 | 28 | #region Reference override 29 | public override string Culture 30 | { 31 | get 32 | { 33 | int locale = 0; 34 | try 35 | { 36 | locale = int.Parse(BaseReferenceNode.LCID, CultureInfo.InvariantCulture); 37 | } 38 | catch(System.FormatException) 39 | { 40 | // Do Nothing 41 | } 42 | if(0 == locale) 43 | { 44 | return string.Empty; 45 | } 46 | CultureInfo culture = new CultureInfo(locale); 47 | return culture.Name; 48 | } 49 | } 50 | public override string Identity 51 | { 52 | get 53 | { 54 | return string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", BaseReferenceNode.TypeGuid.ToString("B"), this.Version); 55 | } 56 | } 57 | public override int MajorVersion 58 | { 59 | get { return BaseReferenceNode.MajorVersionNumber; } 60 | } 61 | public override int MinorVersion 62 | { 63 | get { return BaseReferenceNode.MinorVersionNumber; } 64 | } 65 | public override string Name 66 | { 67 | get { return BaseReferenceNode.Caption; } 68 | } 69 | public override VSLangProj.prjReferenceType Type 70 | { 71 | get 72 | { 73 | return VSLangProj.prjReferenceType.prjReferenceTypeActiveX; 74 | } 75 | } 76 | public override string Version 77 | { 78 | get 79 | { 80 | Version version = new Version(BaseReferenceNode.MajorVersionNumber, BaseReferenceNode.MinorVersionNumber); 81 | return version.ToString(); 82 | } 83 | } 84 | #endregion 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /MPFProject/Automation/OANullProperty.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | 15 | namespace Microsoft.VisualStudio.Project.Automation 16 | { 17 | /// 18 | /// This object defines a so called null object that is returned as instead of null. This is because callers in VSCore usually crash if a null propery is returned for them. 19 | /// 20 | [CLSCompliant(false), ComVisible(true)] 21 | public class OANullProperty : EnvDTE.Property 22 | { 23 | #region fields 24 | private OAProperties parent; 25 | #endregion 26 | 27 | #region ctors 28 | 29 | public OANullProperty(OAProperties parent) 30 | { 31 | this.parent = parent; 32 | } 33 | #endregion 34 | 35 | #region EnvDTE.Property 36 | 37 | public object Application 38 | { 39 | get { return String.Empty; } 40 | } 41 | 42 | public EnvDTE.Properties Collection 43 | { 44 | get 45 | { 46 | //todo: EnvDTE.Property.Collection 47 | return this.parent; 48 | } 49 | } 50 | 51 | public EnvDTE.DTE DTE 52 | { 53 | get { return null; } 54 | } 55 | 56 | public object get_IndexedValue(object index1, object index2, object index3, object index4) 57 | { 58 | return String.Empty; 59 | } 60 | 61 | public void let_Value(object value) 62 | { 63 | //todo: let_Value 64 | } 65 | 66 | public string Name 67 | { 68 | get { return String.Empty; } 69 | } 70 | 71 | public short NumIndices 72 | { 73 | get { return 0; } 74 | } 75 | 76 | public object Object 77 | { 78 | get { return this.parent.Target; } 79 | set 80 | { 81 | } 82 | } 83 | 84 | public EnvDTE.Properties Parent 85 | { 86 | get { return this.parent; } 87 | } 88 | 89 | public void set_IndexedValue(object index1, object index2, object index3, object index4, object value) 90 | { 91 | 92 | } 93 | 94 | public object Value 95 | { 96 | get { return String.Empty; } 97 | set { } 98 | } 99 | #endregion 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /MPFProject/BuildPropertyPage.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using System.Globalization; 15 | using System.Runtime.InteropServices; 16 | using Microsoft.VisualStudio; 17 | 18 | namespace Microsoft.VisualStudio.Project 19 | { 20 | /// 21 | /// Enumerated list of the properties shown on the build property page 22 | /// 23 | internal enum BuildPropertyPageTag 24 | { 25 | OutputPath 26 | } 27 | 28 | /// 29 | /// Defines the properties on the build property page and the logic the binds the properties to project data (load and save) 30 | /// 31 | [CLSCompliant(false), ComVisible(true), Guid("9B3DEA40-7F29-4a17-87A4-00EE08E8241E")] 32 | public class BuildPropertyPage : SettingsPage 33 | { 34 | #region fields 35 | private string outputPath; 36 | 37 | public BuildPropertyPage() 38 | { 39 | this.Name = SR.GetString(SR.BuildCaption, CultureInfo.CurrentUICulture); 40 | } 41 | #endregion 42 | 43 | #region properties 44 | [SRCategoryAttribute(SR.BuildCaption)] 45 | [LocDisplayName(SR.OutputPath)] 46 | [SRDescriptionAttribute(SR.OutputPathDescription)] 47 | public string OutputPath 48 | { 49 | get { return this.outputPath; } 50 | set { this.outputPath = value; this.IsDirty = true; } 51 | } 52 | #endregion 53 | 54 | #region overridden methods 55 | public override string GetClassName() 56 | { 57 | return this.GetType().FullName; 58 | } 59 | 60 | protected override void BindProperties() 61 | { 62 | if(this.ProjectMgr == null) 63 | { 64 | Debug.Assert(false); 65 | return; 66 | } 67 | 68 | this.outputPath = this.GetConfigProperty(BuildPropertyPageTag.OutputPath.ToString()); 69 | } 70 | 71 | protected override int ApplyChanges() 72 | { 73 | if(this.ProjectMgr == null) 74 | { 75 | Debug.Assert(false); 76 | return VSConstants.E_INVALIDARG; 77 | } 78 | 79 | this.SetConfigProperty(BuildPropertyPageTag.OutputPath.ToString(), this.outputPath); 80 | this.IsDirty = false; 81 | return VSConstants.S_OK; 82 | } 83 | #endregion 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /MPFProject/Attributes.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.ComponentModel; 14 | using System.Diagnostics; 15 | using System.Globalization; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | /// 20 | /// Defines a type converter. 21 | /// 22 | /// This is needed to get rid of the type TypeConverter type that could not give back the Type we were passing to him. 23 | /// We do not want to use reflection to get the type back from the ConverterTypeName. Also the GetType methos does not spwan converters from other assemblies. 24 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments"), AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field)] 25 | public sealed class PropertyPageTypeConverterAttribute : Attribute 26 | { 27 | #region fields 28 | Type converterType; 29 | #endregion 30 | 31 | #region ctors 32 | public PropertyPageTypeConverterAttribute(Type type) 33 | { 34 | this.converterType = type; 35 | } 36 | #endregion 37 | 38 | #region properties 39 | public Type ConverterType 40 | { 41 | get 42 | { 43 | return this.converterType; 44 | } 45 | } 46 | #endregion 47 | } 48 | 49 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] 50 | internal sealed class LocDisplayNameAttribute : DisplayNameAttribute 51 | { 52 | #region fields 53 | string name; 54 | #endregion 55 | 56 | #region ctors 57 | public LocDisplayNameAttribute(string name) 58 | { 59 | this.name = name; 60 | } 61 | #endregion 62 | 63 | #region properties 64 | public override string DisplayName 65 | { 66 | get 67 | { 68 | string result = SR.GetString(this.name, CultureInfo.CurrentUICulture); 69 | if(result == null) 70 | { 71 | Debug.Assert(false, "String resource '" + this.name + "' is missing"); 72 | result = this.name; 73 | } 74 | return result; 75 | } 76 | } 77 | #endregion 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /MPFProject/SolutionListenerForProjectOpen.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using Microsoft.VisualStudio; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | using IServiceProvider = System.IServiceProvider; 17 | 18 | namespace Microsoft.VisualStudio.Project 19 | { 20 | 21 | [CLSCompliant(false)] 22 | public class SolutionListenerForProjectOpen : SolutionListener 23 | { 24 | public SolutionListenerForProjectOpen(IServiceProvider serviceProvider) 25 | : base(serviceProvider) 26 | { 27 | } 28 | 29 | public override int OnAfterOpenProject(IVsHierarchy hierarchy, int added) 30 | { 31 | // If this is a new project and our project. We use here that it is only our project that will implemnet the "internal" IBuildDependencyOnProjectContainer. 32 | if(added != 0 && hierarchy is IBuildDependencyUpdate) 33 | { 34 | IVsUIHierarchy uiHierarchy = hierarchy as IVsUIHierarchy; 35 | Debug.Assert(uiHierarchy != null, "The ProjectNode should implement IVsUIHierarchy"); 36 | // Expand and select project node 37 | IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ServiceProvider, HierarchyNode.SolutionExplorer); 38 | if(uiWindow != null) 39 | { 40 | __VSHIERARCHYITEMSTATE state; 41 | uint stateAsInt; 42 | if(uiWindow.GetItemState(uiHierarchy, VSConstants.VSITEMID_ROOT, (uint)__VSHIERARCHYITEMSTATE.HIS_Expanded, out stateAsInt) == VSConstants.S_OK) 43 | { 44 | state = (__VSHIERARCHYITEMSTATE)stateAsInt; 45 | if(state != __VSHIERARCHYITEMSTATE.HIS_Expanded) 46 | { 47 | int hr; 48 | hr = uiWindow.ExpandItem(uiHierarchy, VSConstants.VSITEMID_ROOT, EXPANDFLAGS.EXPF_ExpandParentsToShowItem); 49 | if(ErrorHandler.Failed(hr)) 50 | Trace.WriteLine("Failed to expand project node"); 51 | hr = uiWindow.ExpandItem(uiHierarchy, VSConstants.VSITEMID_ROOT, EXPANDFLAGS.EXPF_SelectItem); 52 | if(ErrorHandler.Failed(hr)) 53 | Trace.WriteLine("Failed to select project node"); 54 | 55 | return hr; 56 | } 57 | } 58 | } 59 | } 60 | return VSConstants.S_OK; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MPFProject/Diagrams/ConfigurationClasses.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AAAAAQQAAAAAAAAAAAAAgAAACAgAQBAAAAAAAACAABA= 7 | Output.cs 8 | 9 | 10 | 11 | 12 | 13 | 14 | AAAAIgABgwTAAAAAAAAAiAAAAIgEQAAggAAAEASAABA= 15 | OutputGroup.cs 16 | 17 | 18 | 19 | 20 | 21 | 22 | AAgCEEJABBAAkaSFCGCkAAEAAEiBYEEKACAAGRDJUEA= 23 | ProjectConfig.cs 24 | 25 | 26 | 27 | 28 | 29 | 30 | AABCAAAACgAACAAAAABABAEIAAQAgAAAIABAEABQAAA= 31 | ProjectConfig.cs 32 | 33 | 34 | 35 | 36 | 37 | 38 | gAWAgFQBAAJIAhACAAgCABAEAQ5MAAAABCAEEAAAEQQ= 39 | ConfigProvider.cs 40 | 41 | 42 | 43 | 44 | 45 | 46 | AgAEAEACAAAAAAQApAQAAgAUABAAA4AAQAIAAAAAgiA= 47 | ProjectElement.cs 48 | 49 | 50 | 51 | 52 | 53 | PcP89b7sGr3/n1KfHv7+dr/f9h//71+3/xPdS+fRan4= 54 | ProjectNode.CopyPaste.cs 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /ASTMapper/AST/Nodes/MappedTypeReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using Boo.Lang.Compiler.Ast; 18 | using Boo.Lang.Compiler.TypeSystem; 19 | using Boo.Lang.Compiler.TypeSystem.Internal; 20 | 21 | namespace Hill30.Boo.ASTMapper.AST.Nodes 22 | { 23 | public class MappedTypeReference : MappedNode 24 | { 25 | private string format; 26 | private string quickInfoTip; 27 | private MappedNode declaringNode; 28 | 29 | public MappedTypeReference(CompileResults results, SimpleTypeReference node) 30 | : base(results, node, node.Name.Length) 31 | { } 32 | 33 | public override MappedNodeType Type { get { return MappedNodeType.TypeReference; } } 34 | 35 | public override string Format { get { return format; } } 36 | 37 | public override string QuickInfoTip { get { return quickInfoTip; } } 38 | 39 | protected override void ResolveImpl(MappedToken token) 40 | { 41 | try 42 | { 43 | var type = TypeSystemServices.GetType(Node); 44 | if (type is Error) 45 | return; 46 | 47 | format = Formats.BooType; 48 | var prefix = "struct "; 49 | if (type.IsClass) 50 | prefix = "class "; 51 | if (type.IsInterface) 52 | prefix = "interface "; 53 | if (type.IsEnum) 54 | prefix = "enumeration "; 55 | quickInfoTip = prefix + type.FullName; 56 | 57 | var internalType = type as AbstractInternalType; 58 | if (internalType != null) 59 | declaringNode = CompileResults.GetMappedNode(internalType.Node); 60 | 61 | } 62 | catch (Exception) 63 | { 64 | return; 65 | } 66 | } 67 | 68 | protected internal override MappedNode DeclarationNode { get { return declaringNode; } } 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ASTMapper/CompilerMessage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using Boo.Lang.Compiler.Ast; 18 | using Microsoft.VisualStudio.Shell; 19 | using Microsoft.VisualStudio.Shell.Interop; 20 | 21 | namespace Hill30.Boo.ASTMapper 22 | { 23 | public class CompilerMessage 24 | { 25 | private ErrorTask task; 26 | 27 | public CompilerMessage(LexicalInfo lexicalInfo, string code, string message, TaskErrorCategory errorCategory) 28 | { 29 | LexicalInfo = lexicalInfo; 30 | Code = code; 31 | Message = message; 32 | ErrorCategory = errorCategory; 33 | } 34 | 35 | public LexicalInfo LexicalInfo { get; private set; } 36 | public string Code { get; private set; } 37 | public string Message { get; private set; } 38 | public TaskErrorCategory ErrorCategory { get; private set; } 39 | public virtual IVsHierarchy FileNode { get { return null; } } 40 | 41 | public void Show(Action exposer, Action navigator) 42 | { 43 | task = new ErrorTask 44 | { 45 | Document = LexicalInfo.FileName, 46 | ErrorCategory = ErrorCategory, 47 | Line = LexicalInfo.Line-1, 48 | Column = LexicalInfo.Column-1, 49 | Priority = TaskPriority.High, 50 | Text = Message, 51 | HierarchyItem = FileNode, 52 | Category = TaskCategory.CodeSense 53 | }; 54 | task.Navigate += 55 | (sender, e) => 56 | { 57 | var errortask = sender as ErrorTask; 58 | if (errortask != null) 59 | navigator(errortask); 60 | } 61 | ; 62 | exposer(task); 63 | } 64 | 65 | public void Hide(Action remover) 66 | { 67 | if (task != null) 68 | remover(task); 69 | task = null; 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MSBuildUtilities/MSBuildUtilities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {ACBAE658-3091-4F71-A3FA-D18B0F9E8DEA} 9 | Library 10 | Properties 11 | Hill30.Boo.MSBuildUtilities 12 | Boo.MSBuildUtilities 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\VSPackage\Boo_files\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | False 36 | 37 | 38 | False 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | -------------------------------------------------------------------------------- /BoocNET40/BoocNET40.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {279A77C4-C249-4C5F-9C20-CBA176F23B8F} 9 | Exe 10 | Properties 11 | BoocNET40 12 | boocNET40 13 | v4.0 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | ..\VSPackage\Boo_files\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | x86 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | False 40 | ..\VSPackage\Boo_files\Boo.Lang.Compiler.dll 41 | 42 | 43 | ..\VSPackage\Boo_files\booc.exe 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /VSPackage/Boo_files/Boo.Microsoft.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | $(BooBinPath)\Boo.LanguageSetup.targets 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | // <autogenerated /> 17 | import System 18 | [assembly: System.Runtime.Versioning.TargetFrameworkAttribute("$(TargetFrameworkMoniker)", FrameworkDisplayName: "$(TargetFrameworkMonikerDisplayName)")] 19 | 20 | 21 | 22 | 23 | 35 | 36 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /MPFProject/Automation/VSProject/OAProjectReference.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Runtime.InteropServices; 15 | using Microsoft.VisualStudio; 16 | using Microsoft.VisualStudio.Shell; 17 | using Microsoft.VisualStudio.Shell.Interop; 18 | using VSLangProj; 19 | 20 | namespace Microsoft.VisualStudio.Project.Automation 21 | { 22 | /// 23 | /// Represents a project reference of the solution 24 | /// 25 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 26 | [ComVisible(true)] 27 | public class OAProjectReference : OAReferenceBase 28 | { 29 | public OAProjectReference(ProjectReferenceNode projectReference) : 30 | base(projectReference) 31 | { 32 | } 33 | 34 | #region Reference override 35 | public override string Culture 36 | { 37 | get { return string.Empty; } 38 | } 39 | public override string Name 40 | { 41 | get { return BaseReferenceNode.ReferencedProjectName; } 42 | } 43 | public override string Identity 44 | { 45 | get 46 | { 47 | return BaseReferenceNode.Caption; 48 | } 49 | } 50 | public override string Path 51 | { 52 | get 53 | { 54 | return BaseReferenceNode.ReferencedProjectOutputPath; 55 | } 56 | } 57 | public override EnvDTE.Project SourceProject 58 | { 59 | get 60 | { 61 | if(Guid.Empty == BaseReferenceNode.ReferencedProjectGuid) 62 | { 63 | return null; 64 | } 65 | IVsHierarchy hierarchy = VsShellUtilities.GetHierarchy(BaseReferenceNode.ProjectMgr.Site, BaseReferenceNode.ReferencedProjectGuid); 66 | if(null == hierarchy) 67 | { 68 | return null; 69 | } 70 | object extObject; 71 | if(Microsoft.VisualStudio.ErrorHandler.Succeeded( 72 | hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out extObject))) 73 | { 74 | return extObject as EnvDTE.Project; 75 | } 76 | return null; 77 | } 78 | } 79 | public override prjReferenceType Type 80 | { 81 | // TODO: Write the code that finds out the type of the output of the source project. 82 | get { return prjReferenceType.prjReferenceTypeAssembly; } 83 | } 84 | public override string Version 85 | { 86 | get { return string.Empty; } 87 | } 88 | #endregion 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /BoocNET35/BoocNET35.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {1C2A9894-0085-4C4D-8BA8-999EF7FD9A51} 9 | Exe 10 | Properties 11 | BoocNET35 12 | boocNET35 13 | v3.5 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | ..\VSPackage\Boo_files\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | x86 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | False 40 | ..\VSPackage\Boo_files\Boo.Lang.Compiler.dll 41 | 42 | 43 | ..\VSPackage\Boo_files\booc.exe 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /MapperTests/TestBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Boo.Lang.Compiler.Ast; 4 | using Hill30.Boo.ASTMapper; 5 | using Microsoft.VisualStudio.TextManager.Interop; 6 | using NUnit.Framework; 7 | 8 | namespace MapperTests 9 | { 10 | public class TestBase 11 | { 12 | public static CompileResults RunCompiler(string source) 13 | { 14 | var results = new CompileResults( 15 | () => "Test", 16 | () => source, 17 | () => 4 18 | ); 19 | CompilerManager.Compile(4, new[] { typeof(SerializableAttribute).Assembly }, new[] { results }); 20 | return results; 21 | } 22 | 23 | // ReSharper disable InconsistentNaming 24 | public struct TestData 25 | { 26 | public string source; 27 | public SourceLocation location; 28 | public string expectedFormat; 29 | public string expectedDatatip; 30 | public TextSpan expectedSpan; 31 | public TextSpan? expectedDefinition; 32 | } 33 | // ReSharper restore InconsistentNaming 34 | 35 | public struct TestTextSpan 36 | { 37 | // ReSharper disable InconsistentNaming 38 | public TextSpan span; 39 | // ReSharper restore InconsistentNaming 40 | public override string ToString() 41 | { 42 | return string.Format("start=({0},{1}) end=({2},{3})", span.iStartLine, span.iStartIndex, span.iEndLine, span.iEndIndex); 43 | } 44 | } 45 | 46 | 47 | public static void RunTest(TestData testData) 48 | { 49 | var results = RunCompiler(testData.source); 50 | 51 | var mToken = results.GetMappedToken(testData.location); 52 | TextSpan ts; 53 | Assert.NotNull(mToken); 54 | Assert.Contains(testData.expectedFormat, mToken.Nodes.ConvertAll(n => n.Format)); 55 | var tip = mToken.GetDataTiptext(out ts); 56 | Assert.AreEqual(testData.expectedDatatip, tip, "Expected '" + testData.expectedDatatip + "' but was '" + tip + "'"); 57 | Assert.AreEqual(testData.expectedSpan, ts, 58 | "Expected Span" + (new TestTextSpan { span = testData.expectedSpan }) + " but was " + (new TestTextSpan { span = ts })); 59 | if (testData.expectedDefinition == null) 60 | return; 61 | var path = Directory.GetCurrentDirectory(); 62 | Assert.AreEqual(Directory.GetCurrentDirectory() + "\\Test", mToken.Goto(out ts)); 63 | Assert.AreEqual(testData.expectedDefinition.Value, ts, 64 | "Expected Definition " + (new TestTextSpan { span = testData.expectedDefinition.Value }) + " but was " + (new TestTextSpan { span = ts })); 65 | 66 | } 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /MPFProject/ProjectPackage.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Globalization; 15 | using System.IO; 16 | using System.Runtime.InteropServices; 17 | using Microsoft.VisualStudio; 18 | using Microsoft.VisualStudio.Shell.Interop; 19 | 20 | namespace Microsoft.VisualStudio.Project 21 | { 22 | /// 23 | /// Defines abstract package. 24 | /// 25 | [ComVisible(true)] 26 | [CLSCompliant(false)] 27 | public abstract class ProjectPackage : Microsoft.VisualStudio.Shell.Package 28 | { 29 | #region fields 30 | /// 31 | /// This is the place to register all the solution listeners. 32 | /// 33 | private List solutionListeners = new List(); 34 | #endregion 35 | 36 | #region properties 37 | /// 38 | /// Add your listener to this list. They should be added in the overridden Initialize befaore calling the base. 39 | /// 40 | protected internal IList SolutionListeners 41 | { 42 | get 43 | { 44 | return this.solutionListeners; 45 | } 46 | } 47 | 48 | public abstract string ProductUserContext { get; } 49 | 50 | #endregion 51 | 52 | #region methods 53 | protected override void Initialize() 54 | { 55 | base.Initialize(); 56 | 57 | // Subscribe to the solution events 58 | this.solutionListeners.Add(new SolutionListenerForProjectReferenceUpdate(this)); 59 | this.solutionListeners.Add(new SolutionListenerForProjectOpen(this)); 60 | this.solutionListeners.Add(new SolutionListenerForBuildDependencyUpdate(this)); 61 | this.solutionListeners.Add(new SolutionListenerForProjectEvents(this)); 62 | 63 | foreach(SolutionListener solutionListener in this.solutionListeners) 64 | { 65 | solutionListener.Init(); 66 | } 67 | } 68 | 69 | protected override void Dispose(bool disposing) 70 | { 71 | // Unadvise solution listeners. 72 | try 73 | { 74 | if(disposing) 75 | { 76 | foreach(SolutionListener solutionListener in this.solutionListeners) 77 | { 78 | solutionListener.Dispose(); 79 | } 80 | 81 | // Dispose the UIThread singleton. 82 | UIThread.Instance.Dispose(); 83 | } 84 | } 85 | finally 86 | { 87 | 88 | base.Dispose(disposing); 89 | } 90 | } 91 | #endregion 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /VSPackage/LanguageService/BooAuthoringScope.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using Microsoft.VisualStudio.Package; 17 | using Microsoft.VisualStudio.TextManager.Interop; 18 | 19 | namespace Hill30.BooProject.LanguageService 20 | { 21 | /// 22 | /// Implements the QuickInfo/ CodeCompletion/Goto functionality 23 | /// 24 | /// 25 | /// The methods in this class are responsible for locating appropriate mapped nodes 26 | /// based on the given coordinates an delegating the response generation to the appropriate methods 27 | /// of the located node(s). 28 | /// 29 | // TODO: hide goto declaration menu item 30 | // TODO: change the Declarations property to GetDeclarations method to support different parse reasons 31 | // TODO: implement the GetMethods 32 | // TODO: implement goto to a file from another project(in another language) 33 | public class BooAuthoringScope : AuthoringScope 34 | { 35 | private readonly BooSource source; 36 | 37 | public BooAuthoringScope(BooSource source) 38 | { 39 | this.source = source; 40 | } 41 | 42 | public override string GetDataTipText(int line, int col, out TextSpan span) 43 | { 44 | if (source != null) 45 | return source.GetDataTipText(line, col, out span); 46 | span = new TextSpan(); 47 | return null; 48 | } 49 | 50 | public override Declarations GetDeclarations(IVsTextView view, int line, int col, TokenInfo info, ParseReason reason) 51 | { 52 | if (source == null) 53 | return null; 54 | return source.GetDeclarations(line, col, info, reason); 55 | } 56 | 57 | public override Methods GetMethods(int line, int col, string name) 58 | { 59 | return null; 60 | } 61 | 62 | public override string Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd, IVsTextView textView, int line, int col, out TextSpan span) 63 | { 64 | if (source != null) 65 | return source.Goto(line, col, out span); 66 | span = new TextSpan(); 67 | return null; 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /MPFProject/Automation/OAReferenceItem.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using System.Diagnostics.CodeAnalysis; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace Microsoft.VisualStudio.Project.Automation 18 | { 19 | /// 20 | /// Represents the automation object equivalent to a ReferenceNode object 21 | /// 22 | [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] 23 | [ComVisible(true), CLSCompliant(false)] 24 | public class OAReferenceItem : OAProjectItem 25 | { 26 | #region ctors 27 | public OAReferenceItem(OAProject project, ReferenceNode node) 28 | : base(project, node) 29 | { 30 | } 31 | 32 | #endregion 33 | 34 | #region overridden methods 35 | /// 36 | /// Not implemented. If called throws invalid operation exception. 37 | /// 38 | public override void Delete() 39 | { 40 | throw new InvalidOperationException(); 41 | } 42 | 43 | 44 | /// 45 | /// Not implemented. If called throws invalid operation exception. 46 | /// 47 | /// A Constants. vsViewKind indicating the type of view to use. 48 | /// 49 | public override EnvDTE.Window Open(string viewKind) 50 | { 51 | throw new InvalidOperationException(); 52 | } 53 | 54 | /// 55 | /// Gets or sets the name of the object. 56 | /// 57 | public override string Name 58 | { 59 | get 60 | { 61 | return base.Name; 62 | } 63 | set 64 | { 65 | throw new InvalidOperationException(); 66 | } 67 | } 68 | 69 | /// 70 | /// Gets the ProjectItems collection containing the ProjectItem object supporting this property. 71 | /// 72 | public override EnvDTE.ProjectItems Collection 73 | { 74 | get 75 | { 76 | // Get the parent node (ReferenceContainerNode) 77 | ReferenceContainerNode parentNode = this.Node.Parent as ReferenceContainerNode; 78 | Debug.Assert(parentNode != null, "Failed to get the parent node"); 79 | 80 | // Get the ProjectItems object for the parent node 81 | if(parentNode != null) 82 | { 83 | // The root node for the project 84 | return ((OAReferenceFolderItem)parentNode.GetAutomationObject()).ProjectItems; 85 | } 86 | 87 | return null; 88 | } 89 | } 90 | #endregion 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ASTMapper/AST/MappedToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using Microsoft.VisualStudio.TextManager.Interop; 20 | using Microsoft.VisualStudio.Package; 21 | 22 | namespace Hill30.Boo.ASTMapper.AST 23 | { 24 | public class MappedToken : IComparable 25 | { 26 | private readonly List nodes = new List(); 27 | 28 | public MappedToken(int index) 29 | { 30 | Index = index; 31 | } 32 | 33 | public MappedToken(int index, int length) 34 | { 35 | Index = index; 36 | Length = length; 37 | } 38 | 39 | public int Index { get; private set; } 40 | public int Length { get; private set; } 41 | public List Nodes { get { return nodes; } } 42 | 43 | #region IComparable Members 44 | 45 | public int CompareTo(MappedToken other) 46 | { 47 | return Index.CompareTo(other.Index); 48 | } 49 | 50 | #endregion 51 | 52 | public string GetDataTiptext(out TextSpan span) 53 | { 54 | var tip = ""; 55 | span = new TextSpan(); 56 | foreach (var node in nodes.Where(node => node.QuickInfoTip != null)) 57 | { 58 | span = span.Union(node.TextSpan); 59 | if (tip != "") 60 | tip += '\n'; 61 | tip += node.QuickInfoTip; 62 | } 63 | return tip; 64 | } 65 | 66 | public Declarations GetDeclarations(TokenInfo info, ParseReason reason) 67 | { 68 | var node = Nodes.Where(n => n.Declarations.GetCount() > 0).FirstOrDefault(); 69 | if (node == null) 70 | return new BooDeclarations(); 71 | return node.Declarations; 72 | } 73 | 74 | public string Goto(out TextSpan span) 75 | { 76 | var node = nodes.Where(n => n.DeclarationNode != null).FirstOrDefault(); 77 | if (node != null) 78 | { 79 | span = node.DeclarationNode.TextSpan; 80 | return node.DeclarationNode.LexicalInfo.FullPath; 81 | } 82 | span = new TextSpan(); 83 | return null; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CSharpProjectTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Microsoft.VsSDK.IntegrationTestLibrary; 6 | using Microsoft.VSSDK.Tools.VsIdeTesting; 7 | 8 | namespace BooProject_IntegrationTests.IntegrationTests 9 | { 10 | [TestClass] 11 | public class CSharpProjectTests 12 | { 13 | #region fields 14 | private delegate void ThreadInvoker(); 15 | private TestContext _testContext; 16 | #endregion 17 | 18 | #region properties 19 | /// 20 | ///Gets or sets the test context which provides 21 | ///information about and functionality for the current test run. 22 | /// 23 | public TestContext TestContext 24 | { 25 | get { return _testContext; } 26 | set { _testContext = value; } 27 | } 28 | #endregion 29 | 30 | #region ctors 31 | public CSharpProjectTests() 32 | { 33 | } 34 | #endregion 35 | 36 | #region Additional test attributes 37 | // 38 | // You can use the following additional attributes as you write your tests: 39 | // 40 | // Use ClassInitialize to run code before running the first test in the class 41 | // [ClassInitialize()] 42 | // public static void MyClassInitialize(TestContext testContext) { } 43 | // 44 | // Use ClassCleanup to run code after all tests in a class have run 45 | // [ClassCleanup()] 46 | // public static void MyClassCleanup() { } 47 | // 48 | // Use TestInitialize to run code before running each test 49 | // [TestInitialize()] 50 | // public void MyTestInitialize() { } 51 | // 52 | // Use TestCleanup to run code after each test has run 53 | // [TestCleanup()] 54 | // public void MyTestCleanup() { } 55 | // 56 | #endregion 57 | 58 | [TestMethod] 59 | [HostType("VS IDE")] 60 | public void WinformsApplication() 61 | { 62 | UIThreadInvoker.Invoke((ThreadInvoker)delegate() 63 | { 64 | TestUtils testUtils = new TestUtils(); 65 | 66 | testUtils.CreateEmptySolution(TestContext.TestDir, "CSWinApp"); 67 | Assert.AreEqual(0, testUtils.ProjectCount()); 68 | 69 | //Create Winforms application project 70 | //TestUtils.CreateProjectFromTemplate("MyWindowsApp", "Windows Application", "CSharp", false); 71 | //Assert.AreEqual(1, TestUtils.ProjectCount()); 72 | 73 | //TODO Verify that we can debug launch the application 74 | 75 | //TODO Set Break point and verify that will hit 76 | 77 | //TODO Verify Adding new project item to project 78 | 79 | }); 80 | } 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /MPFProject/BuildDependency.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio; 14 | using Microsoft.VisualStudio.Shell; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | public class BuildDependency : IVsBuildDependency 20 | { 21 | Guid referencedProjectGuid = Guid.Empty; 22 | ProjectNode projectMgr = null; 23 | 24 | [CLSCompliant(false)] 25 | public BuildDependency(ProjectNode projectMgr, Guid projectReference) 26 | { 27 | this.referencedProjectGuid = projectReference; 28 | this.projectMgr = projectMgr; 29 | } 30 | 31 | #region IVsBuildDependency methods 32 | public int get_CanonicalName(out string canonicalName) 33 | { 34 | canonicalName = null; 35 | return VSConstants.S_OK; 36 | } 37 | 38 | public int get_Type(out System.Guid guidType) 39 | { 40 | // All our dependencies are build projects 41 | guidType = VSConstants.GUID_VS_DEPTYPE_BUILD_PROJECT; 42 | return VSConstants.S_OK; 43 | } 44 | 45 | public int get_Description(out string description) 46 | { 47 | description = null; 48 | return VSConstants.S_OK; 49 | } 50 | 51 | [CLSCompliant(false)] 52 | public int get_HelpContext(out uint helpContext) 53 | { 54 | helpContext = 0; 55 | return VSConstants.E_NOTIMPL; 56 | } 57 | 58 | public int get_HelpFile(out string helpFile) 59 | { 60 | helpFile = null; 61 | return VSConstants.E_NOTIMPL; 62 | } 63 | 64 | public int get_MustUpdateBefore(out int mustUpdateBefore) 65 | { 66 | // Must always update dependencies 67 | mustUpdateBefore = 1; 68 | 69 | return VSConstants.S_OK; 70 | } 71 | 72 | public int get_ReferredProject(out object unknownProject) 73 | { 74 | unknownProject = null; 75 | 76 | unknownProject = this.GetReferencedHierarchy(); 77 | 78 | // If we cannot find the referenced hierarchy return S_FALSE. 79 | return (unknownProject == null) ? VSConstants.S_FALSE : VSConstants.S_OK; 80 | } 81 | 82 | #endregion 83 | 84 | #region helper methods 85 | private IVsHierarchy GetReferencedHierarchy() 86 | { 87 | IVsHierarchy hierarchy = null; 88 | 89 | if(this.referencedProjectGuid == Guid.Empty || this.projectMgr == null || this.projectMgr.IsClosed) 90 | { 91 | return hierarchy; 92 | } 93 | 94 | return VsShellUtilities.GetHierarchy(this.projectMgr.Site, this.referencedProjectGuid); 95 | 96 | } 97 | 98 | #endregion 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_UnitTests/MenuItemTests/UIShellServiceMock.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio; 14 | using Microsoft.VisualStudio.Shell.Interop; 15 | using Microsoft.VsSDK.UnitTestLibrary; 16 | 17 | namespace BooProject_UnitTests 18 | { 19 | static class UIShellServiceMock 20 | { 21 | private static GenericMockFactory uiShellFactory; 22 | 23 | #region UiShell Getters 24 | /// 25 | /// Returns an IVsUiShell that does not implement any methods 26 | /// 27 | /// 28 | internal static BaseMock GetUiShellInstance() 29 | { 30 | if (uiShellFactory == null) 31 | { 32 | uiShellFactory = new GenericMockFactory("UiShell", new Type[] { typeof(IVsUIShell), typeof(IVsUIShellOpenDocument) }); 33 | } 34 | BaseMock uiShell = uiShellFactory.GetInstance(); 35 | return uiShell; 36 | } 37 | 38 | /// 39 | /// Get an IVsUiShell that implements SetWaitCursor, SaveDocDataToFile, ShowMessageBox 40 | /// 41 | /// uishell mock 42 | internal static BaseMock GetUiShellInstance0() 43 | { 44 | BaseMock uiShell = GetUiShellInstance(); 45 | string name = string.Format("{0}.{1}", typeof(IVsUIShell).FullName, "SetWaitCursor"); 46 | uiShell.AddMethodCallback(name, new EventHandler(SetWaitCursorCallBack)); 47 | 48 | name = string.Format("{0}.{1}", typeof(IVsUIShell).FullName, "SaveDocDataToFile"); 49 | uiShell.AddMethodCallback(name, new EventHandler(SaveDocDataToFileCallBack)); 50 | 51 | name = string.Format("{0}.{1}", typeof(IVsUIShell).FullName, "ShowMessageBox"); 52 | uiShell.AddMethodCallback(name, new EventHandler(ShowMessageBoxCallBack)); 53 | return uiShell; 54 | } 55 | #endregion 56 | 57 | #region Callbacks 58 | private static void SetWaitCursorCallBack(object caller, CallbackArgs arguments) 59 | { 60 | arguments.ReturnValue = VSConstants.S_OK; 61 | } 62 | 63 | private static void SaveDocDataToFileCallBack(object caller, CallbackArgs arguments) 64 | { 65 | arguments.ReturnValue = VSConstants.S_OK; 66 | } 67 | 68 | private static void ShowMessageBoxCallBack(object caller, CallbackArgs arguments) 69 | { 70 | arguments.ReturnValue = VSConstants.S_OK; 71 | arguments.SetParameter(10, (int)System.Windows.Forms.DialogResult.Yes); 72 | } 73 | 74 | #endregion 75 | } 76 | } -------------------------------------------------------------------------------- /MPFProject/Diagrams/PropertiesClasses.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AAAACAAACAAAAAAgAAAAgAAAABAEIAAAAERAAAAACAA= 7 | LocalizableProperties.cs 8 | 9 | 10 | 11 | 12 | 13 | 14 | CAAAAAAgAAAAAAAAAAAAAAAAAAAAIQAAAAAAAABAAAA= 15 | NodeProperties.cs 16 | 17 | 18 | 19 | 20 | 21 | CAAAAAAAAAAAAAAAAAAAAAQAAAAAIAAAAAAAAAAAAAA= 22 | NodeProperties.cs 23 | 24 | 25 | 26 | 27 | 28 | EQACAAAAAAAAAQAAAAAECAQAAAkgAggAAAhECAEAAAA= 29 | NodeProperties.cs 30 | 31 | 32 | 33 | 34 | 35 | 36 | CAAAAAAgAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABAAAA= 37 | NodeProperties.cs 38 | 39 | 40 | 41 | 42 | 43 | AAABhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAgQAYA= 44 | NodeProperties.cs 45 | 46 | 47 | 48 | 49 | 50 | CAAAAAAAABAAAAAAAAAAAAAAAAAgIAgAAAQAAABAAAA= 51 | NodeProperties.cs 52 | 53 | 54 | 55 | 56 | 57 | CAAAAAAABAAAAAAAAAAAAAAAAAAAIAAAAAAAAABAAAA= 58 | NodeProperties.cs 59 | 60 | 61 | 62 | 63 | 64 | CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 65 | NodeProperties.cs 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /MPFProject/ProjectOptions.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System.Collections.Specialized; 13 | using System.Diagnostics.CodeAnalysis; 14 | using System.Runtime.Versioning; 15 | 16 | namespace Microsoft.VisualStudio.Project 17 | { 18 | public class ProjectOptions : System.CodeDom.Compiler.CompilerParameters 19 | { 20 | public string Config { get; set; } 21 | 22 | public ModuleKindFlags ModuleKind { get; set; } 23 | 24 | public bool EmitManifest { get; set; } 25 | 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 27 | public StringCollection DefinedPreprocessorSymbols { get; set; } 28 | 29 | public string XmlDocFileName { get; set; } 30 | 31 | public string RecursiveWildcard { get; set; } 32 | 33 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 34 | public StringCollection ReferencedModules { get; set; } 35 | 36 | public string Win32Icon { get; set; } 37 | 38 | public bool PdbOnly { get; set; } 39 | 40 | public bool Optimize { get; set; } 41 | 42 | public bool IncrementalCompile { get; set; } 43 | 44 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] 45 | public int[] SuppressedWarnings { get; set; } 46 | 47 | public bool CheckedArithmetic { get; set; } 48 | 49 | public bool AllowUnsafeCode { get; set; } 50 | 51 | public bool DisplayCommandLineHelp { get; set; } 52 | 53 | public bool SuppressLogo { get; set; } 54 | 55 | public long BaseAddress { get; set; } 56 | 57 | public string BugReportFileName { get; set; } 58 | 59 | /// must be an int if not null 60 | public object CodePage { get; set; } 61 | 62 | public bool EncodeOutputInUtf8 { get; set; } 63 | 64 | public bool FullyQualifyPaths { get; set; } 65 | 66 | public int FileAlignment { get; set; } 67 | 68 | public bool NoStandardLibrary { get; set; } 69 | 70 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 71 | public StringCollection AdditionalSearchPaths { get; set; } 72 | 73 | public bool HeuristicReferenceResolution { get; set; } 74 | 75 | public string RootNamespace { get; set; } 76 | 77 | public bool CompileAndExecute { get; set; } 78 | 79 | /// must be an int if not null. 80 | public object UserLocaleId { get; set; } 81 | 82 | public FrameworkName TargetFrameworkMoniker { get; set; } 83 | 84 | public ProjectOptions() 85 | { 86 | EmitManifest = true; 87 | ModuleKind = ModuleKindFlags.ConsoleApplication; 88 | } 89 | 90 | public virtual string GetOptionHelp() 91 | { 92 | return null; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /MPFProject/ProjectDesignerDocumentManager.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using Microsoft.VisualStudio; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; 17 | 18 | namespace Microsoft.VisualStudio.Project 19 | { 20 | class ProjectDesignerDocumentManager : DocumentManager 21 | { 22 | #region ctors 23 | public ProjectDesignerDocumentManager(ProjectNode node) 24 | : base(node) 25 | { 26 | } 27 | #endregion 28 | 29 | #region overriden methods 30 | 31 | public override int Open(ref Guid logicalView, IntPtr docDataExisting, out IVsWindowFrame windowFrame, WindowFrameShowAction windowFrameAction) 32 | { 33 | Guid editorGuid = VSConstants.GUID_ProjectDesignerEditor; 34 | return this.OpenWithSpecific(0, ref editorGuid, String.Empty, ref logicalView, docDataExisting, out windowFrame, windowFrameAction); 35 | } 36 | 37 | public override int OpenWithSpecific(uint editorFlags, ref Guid editorType, string physicalView, ref Guid logicalView, IntPtr docDataExisting, out IVsWindowFrame frame, WindowFrameShowAction windowFrameAction) 38 | { 39 | frame = null; 40 | Debug.Assert(editorType == VSConstants.GUID_ProjectDesignerEditor, "Cannot open project designer with guid " + editorType.ToString()); 41 | 42 | 43 | if(this.Node == null || this.Node.ProjectMgr == null || this.Node.ProjectMgr.IsClosed) 44 | { 45 | return VSConstants.E_FAIL; 46 | } 47 | 48 | IVsUIShellOpenDocument uiShellOpenDocument = this.Node.ProjectMgr.Site.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument; 49 | IOleServiceProvider serviceProvider = this.Node.ProjectMgr.Site.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider; 50 | 51 | if(serviceProvider != null && uiShellOpenDocument != null) 52 | { 53 | string fullPath = this.GetFullPathForDocument(); 54 | string caption = this.GetOwnerCaption(); 55 | 56 | IVsUIHierarchy parentHierarchy = this.Node.ProjectMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchy) as IVsUIHierarchy; 57 | 58 | int parentHierarchyItemId = (int)this.Node.ProjectMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid); 59 | 60 | ErrorHandler.ThrowOnFailure(uiShellOpenDocument.OpenSpecificEditor(editorFlags, fullPath, ref editorType, physicalView, ref logicalView, caption, parentHierarchy, (uint)parentHierarchyItemId, docDataExisting, serviceProvider, out frame)); 61 | 62 | if(frame != null) 63 | { 64 | if(windowFrameAction == WindowFrameShowAction.Show) 65 | { 66 | ErrorHandler.ThrowOnFailure(frame.Show()); 67 | } 68 | } 69 | } 70 | 71 | return VSConstants.S_OK; 72 | } 73 | #endregion 74 | 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /MPFProject/EnumDependencies.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections.Generic; 14 | using Microsoft.VisualStudio; 15 | using Microsoft.VisualStudio.Shell.Interop; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | [CLSCompliant(false)] 20 | public class EnumDependencies : IVsEnumDependencies 21 | { 22 | private List dependencyList = new List(); 23 | 24 | private uint nextIndex; 25 | 26 | public EnumDependencies(IList dependencyList) 27 | { 28 | if (dependencyList == null) 29 | { 30 | throw new ArgumentNullException("dependencyList"); 31 | } 32 | 33 | foreach(IVsDependency dependency in dependencyList) 34 | { 35 | this.dependencyList.Add(dependency); 36 | } 37 | } 38 | 39 | public EnumDependencies(IList dependencyList) 40 | { 41 | if (dependencyList == null) 42 | { 43 | throw new ArgumentNullException("dependencyList"); 44 | } 45 | 46 | foreach(IVsBuildDependency dependency in dependencyList) 47 | { 48 | this.dependencyList.Add(dependency); 49 | } 50 | } 51 | 52 | public int Clone(out IVsEnumDependencies enumDependencies) 53 | { 54 | enumDependencies = new EnumDependencies(this.dependencyList); 55 | ErrorHandler.ThrowOnFailure(enumDependencies.Skip(this.nextIndex)); 56 | return VSConstants.S_OK; 57 | } 58 | 59 | public int Next(uint elements, IVsDependency[] dependencies, out uint elementsFetched) 60 | { 61 | elementsFetched = 0; 62 | if (dependencies == null) 63 | { 64 | throw new ArgumentNullException("dependencies"); 65 | } 66 | 67 | uint fetched = 0; 68 | int count = this.dependencyList.Count; 69 | 70 | while(this.nextIndex < count && elements > 0 && fetched < count) 71 | { 72 | dependencies[fetched] = this.dependencyList[(int)this.nextIndex]; 73 | this.nextIndex++; 74 | fetched++; 75 | elements--; 76 | 77 | } 78 | 79 | elementsFetched = fetched; 80 | 81 | // Did we get 'em all? 82 | return (elements == 0 ? VSConstants.S_OK : VSConstants.S_FALSE); 83 | } 84 | 85 | public int Reset() 86 | { 87 | this.nextIndex = 0; 88 | return VSConstants.S_OK; 89 | } 90 | 91 | public int Skip(uint elements) 92 | { 93 | this.nextIndex += elements; 94 | uint count = (uint)this.dependencyList.Count; 95 | 96 | if(this.nextIndex > count) 97 | { 98 | this.nextIndex = count; 99 | return VSConstants.S_FALSE; 100 | } 101 | 102 | return VSConstants.S_OK; 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /MPFProject/Diagrams/ReferenceClasses.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ReferenceNode.cs 9 | 10 | 11 | 12 | 13 | AIBAAGagAAFAAAAAgACiIAAAAAAQAAEAGAAQAABAAAA= 14 | ReferenceNode.cs 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | CIACCFYCAgAAgAEgAIACBAQAAAAQABAACAAAAECACgA= 30 | ProjectReferenceNode.cs 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | AAAQAAYAAAQAgAAQAEAAAAAAAAAAAAAAEQAAAACAAAA= 43 | BuildDependency.cs 44 | 45 | 46 | 47 | 48 | 49 | 50 | AACACCIAAAIAACQgQAAEBAQAgACAAAABCAgQAQACIAA= 51 | ComReferenceNode.cs 52 | 53 | 54 | 55 | 56 | 57 | AAAAAAAAAAAAAAAAAQAAIAAAAgAAAAAIAAAAgABAAAA= 58 | SolutionListenerForProjectReferenceUpdate.cs 59 | 60 | 61 | 62 | 63 | 64 | AAIACRBQoCAQCCAAEAIAJAAACgQBAAAYAQAiiAIAAAA= 65 | SolutionListener.cs 66 | 67 | 68 | 69 | 70 | 71 | 72 | AAACCCJAACAACAAgEAoAAAACBABACIAIGAAAEACAABw= 73 | AssemblyReferenceNode.cs 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /MPFProject/Diagrams/HierarchyClasses.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BolBCECAAgFAAIEAgBACZAAAAAAAAAAQyAQQAIRGQIA= 7 | FileNode.cs 8 | 9 | 10 | 11 | 12 | 13 | PcP89b7sGr3/n1KfHv7+dr/f9h//71+3/xPdS+fRan4= 14 | ProjectNode.CopyPaste.cs 15 | 16 | 17 | 18 | 19 | 20 | 21 | NKl4K26oqqdRuqD4sdAKZLc0zKtxgtmgOJLYADLHccE= 22 | HierarchyNode.cs 23 | 24 | 25 | 26 | 27 | 28 | 29 | AABFCBAAAAYgAAAgQAAAAAAEQMABAAAATAWAAAABAAE= 30 | ProjectContainerNode.cs 31 | 32 | 33 | 34 | 35 | 36 | 37 | BIAQEAKAAgFAAAAAgIACJAAABAICAAAACAAQAAACAQA= 38 | FolderNode.cs 39 | 40 | 41 | 42 | 43 | 44 | AIBAAGagAAFAAAAAgACiIAAAAAAQAAEAGAAQAABAAAA= 45 | ReferenceNode.cs 46 | 47 | 48 | 49 | 50 | 51 | AABICACgAAUAAIAgggACIABAAAYQQAAAGEIQAABAARA= 52 | ReferenceContainerNode.cs 53 | 54 | 55 | 56 | 57 | 58 | 59 | AACACCIAAAIAACQgQAAEBAQAgACAAAABCAgQAQACIAA= 60 | ComReferenceNode.cs 61 | 62 | 63 | 64 | 65 | 66 | CIACCFYCAgAAgAEgAIACBAQAAAAQABAACAAAAECACgA= 67 | ProjectReferenceNode.cs 68 | 69 | 70 | 71 | 72 | 73 | AAACCCJAACAACAAgEAoAAAACBABACIAIGAAAEACAABw= 74 | AssemblyReferenceNode.cs 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /MPFProject/Misc/ExternDll.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | namespace Microsoft.VisualStudio.Project 13 | { 14 | internal static class ExternDll 15 | { 16 | 17 | #if FEATURE_PAL 18 | 19 | #if !PLATFORM_UNIX 20 | internal const String DLLPREFIX = ""; 21 | internal const String DLLSUFFIX = ".dll"; 22 | #else // !PLATFORM_UNIX 23 | #if __APPLE__ 24 | internal const String DLLPREFIX = "lib"; 25 | internal const String DLLSUFFIX = ".dylib"; 26 | #elif _AIX 27 | internal const String DLLPREFIX = "lib"; 28 | internal const String DLLSUFFIX = ".a"; 29 | #elif __hppa__ || IA64 30 | internal const String DLLPREFIX = "lib"; 31 | internal const String DLLSUFFIX = ".sl"; 32 | #else 33 | internal const String DLLPREFIX = "lib"; 34 | internal const String DLLSUFFIX = ".so"; 35 | #endif 36 | #endif // !PLATFORM_UNIX 37 | 38 | public const string Kernel32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX; 39 | public const string User32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX; 40 | public const string Mscoree = DLLPREFIX + "sscoree" + DLLSUFFIX; 41 | #else 42 | public const string Activeds = "activeds.dll"; 43 | public const string Advapi32 = "advapi32.dll"; 44 | public const string Comctl32 = "comctl32.dll"; 45 | public const string Comdlg32 = "comdlg32.dll"; 46 | public const string Gdi32 = "gdi32.dll"; 47 | public const string Gdiplus = "gdiplus.dll"; 48 | public const string Hhctrl = "hhctrl.ocx"; 49 | public const string Imm32 = "imm32.dll"; 50 | public const string Kernel32 = "kernel32.dll"; 51 | public const string Loadperf = "Loadperf.dll"; 52 | public const string Mscoree = "mscoree.dll"; 53 | public const string Mscorwks = "mscorwks.dll"; 54 | public const string Msi = "msi.dll"; 55 | public const string Mqrt = "mqrt.dll"; 56 | public const string Ntdll = "ntdll.dll"; 57 | public const string Ole32 = "ole32.dll"; 58 | public const string Oleacc = "oleacc.dll"; 59 | public const string Oleaut32 = "oleaut32.dll"; 60 | public const string Olepro32 = "olepro32.dll"; 61 | public const string PerfCounter = "perfcounter.dll"; 62 | public const string Powrprof = "Powrprof.dll"; 63 | public const string Psapi = "psapi.dll"; 64 | public const string Shell32 = "shell32.dll"; 65 | public const string Shfolder = "shfolder.dll"; 66 | public const string User32 = "user32.dll"; 67 | public const string Uxtheme = "uxtheme.dll"; 68 | public const string WinMM = "winmm.dll"; 69 | public const string Winspool = "winspool.drv"; 70 | public const string Wtsapi32 = "wtsapi32.dll"; 71 | public const string Version = "version.dll"; 72 | public const string Vsassert = "vsassert.dll"; 73 | public const string Shlwapi = "shlwapi.dll"; 74 | public const string Crypt32 = "crypt32.dll"; 75 | 76 | // system.data specific 77 | internal const string Odbc32 = "odbc32.dll"; 78 | internal const string SNI = "System.Data.dll"; 79 | 80 | // system.data.oracleclient specific 81 | internal const string OciDll = "oci.dll"; 82 | internal const string OraMtsDll = "oramts.dll"; 83 | #endif //!FEATURE_PAL 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /MPFProject/Automation/AutomationScope.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio.Shell.Interop; 14 | using ErrorHandler = Microsoft.VisualStudio.ErrorHandler; 15 | 16 | namespace Microsoft.VisualStudio.Project.Automation 17 | { 18 | /// 19 | /// Helper class that handle the scope of an automation function. 20 | /// It should be used inside a "using" directive to define the scope of the 21 | /// automation function and make sure that the ExitAutomation method is called. 22 | /// 23 | internal class AutomationScope : IDisposable 24 | { 25 | private IVsExtensibility3 extensibility; 26 | private bool inAutomation; 27 | private static volatile object Mutex; 28 | private bool isDisposed; 29 | 30 | /// 31 | /// Initializes the class. 32 | /// 33 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] 34 | static AutomationScope() 35 | { 36 | Mutex = new object(); 37 | } 38 | 39 | /// 40 | /// Defines the beginning of the scope of an automation function. This constuctor 41 | /// calls EnterAutomationFunction to signal the Shell that the current function is 42 | /// changing the status of the automation objects. 43 | /// 44 | public AutomationScope(IServiceProvider provider) 45 | { 46 | if(null == provider) 47 | { 48 | throw new ArgumentNullException("provider"); 49 | } 50 | extensibility = provider.GetService(typeof(EnvDTE.IVsExtensibility)) as IVsExtensibility3; 51 | if(null == extensibility) 52 | { 53 | throw new InvalidOperationException(); 54 | } 55 | ErrorHandler.ThrowOnFailure(extensibility.EnterAutomationFunction()); 56 | inAutomation = true; 57 | } 58 | 59 | /// 60 | /// Ends the scope of the automation function. This function is also called by the 61 | /// Dispose method. 62 | /// 63 | public void ExitAutomation() 64 | { 65 | if(inAutomation) 66 | { 67 | ErrorHandler.ThrowOnFailure(extensibility.ExitAutomationFunction()); 68 | inAutomation = false; 69 | } 70 | } 71 | 72 | /// 73 | /// Gets the IVsExtensibility3 interface used in the automation function. 74 | /// 75 | public IVsExtensibility3 Extensibility 76 | { 77 | get { return extensibility; } 78 | } 79 | 80 | /// 81 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 82 | /// 83 | public void Dispose() 84 | { 85 | this.Dispose(true); 86 | GC.SuppressFinalize(this); 87 | } 88 | 89 | #region IDisposable Members 90 | private void Dispose(bool disposing) 91 | { 92 | if(!this.isDisposed) 93 | { 94 | lock(Mutex) 95 | { 96 | if(disposing) 97 | { 98 | ExitAutomation(); 99 | } 100 | 101 | this.isDisposed = true; 102 | } 103 | } 104 | } 105 | #endregion 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /MPFProject/LocalizableProperties.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections; 14 | using System.ComponentModel; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | /// 20 | /// Enables a managed object to expose properties and attributes for COM objects. 21 | /// 22 | [ComVisible(true)] 23 | public class LocalizableProperties : ICustomTypeDescriptor 24 | { 25 | #region ICustomTypeDescriptor 26 | public virtual AttributeCollection GetAttributes() 27 | { 28 | AttributeCollection col = TypeDescriptor.GetAttributes(this, true); 29 | return col; 30 | } 31 | 32 | public virtual EventDescriptor GetDefaultEvent() 33 | { 34 | EventDescriptor ed = TypeDescriptor.GetDefaultEvent(this, true); 35 | return ed; 36 | } 37 | 38 | public virtual PropertyDescriptor GetDefaultProperty() 39 | { 40 | PropertyDescriptor pd = TypeDescriptor.GetDefaultProperty(this, true); 41 | return pd; 42 | } 43 | 44 | public virtual object GetEditor(Type editorBaseType) 45 | { 46 | object o = TypeDescriptor.GetEditor(this, editorBaseType, true); 47 | return o; 48 | } 49 | 50 | public virtual EventDescriptorCollection GetEvents() 51 | { 52 | EventDescriptorCollection edc = TypeDescriptor.GetEvents(this, true); 53 | return edc; 54 | } 55 | 56 | public virtual EventDescriptorCollection GetEvents(System.Attribute[] attributes) 57 | { 58 | EventDescriptorCollection edc = TypeDescriptor.GetEvents(this, attributes, true); 59 | return edc; 60 | } 61 | 62 | public virtual object GetPropertyOwner(PropertyDescriptor pd) 63 | { 64 | return this; 65 | } 66 | 67 | public virtual PropertyDescriptorCollection GetProperties() 68 | { 69 | PropertyDescriptorCollection pcol = GetProperties(null); 70 | return pcol; 71 | } 72 | 73 | public virtual PropertyDescriptorCollection GetProperties(System.Attribute[] attributes) 74 | { 75 | ArrayList newList = new ArrayList(); 76 | PropertyDescriptorCollection props = TypeDescriptor.GetProperties(this, attributes, true); 77 | 78 | for(int i = 0; i < props.Count; i++) 79 | newList.Add(CreateDesignPropertyDescriptor(props[i])); 80 | 81 | return new PropertyDescriptorCollection((PropertyDescriptor[])newList.ToArray(typeof(PropertyDescriptor))); ; 82 | } 83 | 84 | public virtual DesignPropertyDescriptor CreateDesignPropertyDescriptor(PropertyDescriptor propertyDescriptor) 85 | { 86 | return new DesignPropertyDescriptor(propertyDescriptor); 87 | } 88 | 89 | public virtual string GetComponentName() 90 | { 91 | string name = TypeDescriptor.GetComponentName(this, true); 92 | return name; 93 | } 94 | 95 | public virtual TypeConverter GetConverter() 96 | { 97 | TypeConverter tc = TypeDescriptor.GetConverter(this, true); 98 | return tc; 99 | } 100 | 101 | public virtual string GetClassName() 102 | { 103 | return this.GetType().FullName; 104 | } 105 | 106 | #endregion ICustomTypeDescriptor 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /ASTMapper/TextSpanExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2010 Michael Feingold 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 | 16 | using System; 17 | using Boo.Lang.Compiler.Ast; 18 | using Microsoft.VisualStudio.Text; 19 | using Microsoft.VisualStudio.TextManager.Interop; 20 | 21 | namespace Hill30.Boo.ASTMapper 22 | { 23 | public static class TextSpanExtensions 24 | { 25 | public static TextSpan Union(this TextSpan self, TextSpan span) 26 | { 27 | if (self.iEndIndex == 0 && self.iEndLine == 0 && self.iStartIndex == 0 && self.iStartLine == 0) 28 | return span; 29 | return new TextSpan 30 | { 31 | iStartLine = Math.Min(self.iStartLine, span.iStartLine), 32 | iStartIndex = 33 | self.iStartLine < span.iStartLine 34 | ? self.iStartIndex 35 | : self.iStartLine > span.iStartLine 36 | ? span.iStartIndex 37 | : Math.Min(self.iStartIndex, span.iStartIndex), 38 | iEndLine = Math.Max(self.iEndLine, span.iEndLine), 39 | iEndIndex = 40 | self.iEndLine < span.iEndLine 41 | ? span.iEndIndex 42 | : self.iEndLine > span.iEndLine 43 | ? self.iEndIndex 44 | : Math.Max(self.iEndIndex, span.iEndIndex), 45 | }; 46 | } 47 | 48 | public static Span GetSpan(this TextSpan self, ITextSnapshot snapshot) 49 | { 50 | var start = snapshot.GetLineFromLineNumber(self.iStartLine).Start + self.iStartIndex; 51 | var end = snapshot.GetLineFromLineNumber(self.iEndLine).Start + self.iEndIndex; 52 | return new Span(start, end - start); 53 | } 54 | 55 | public static bool Contains(this TextSpan self, int line, int column) 56 | { 57 | if (line < self.iStartLine) 58 | return false; 59 | if (line == self.iStartLine && column < self.iStartIndex) 60 | return false; 61 | if (line == self.iEndLine && column > self.iEndIndex) 62 | return false; 63 | if (line > self.iEndLine) 64 | return false; 65 | return true; 66 | } 67 | 68 | public static TextSpan GetTextSpan(this Node node, IFileNode fileNode) 69 | { 70 | var start = fileNode.MapPosition(node.LexicalInfo.Line, node.LexicalInfo.Column); 71 | var end = fileNode.MapPosition(node.EndSourceLocation.Line, node.EndSourceLocation.Column); 72 | return new TextSpan 73 | { 74 | iStartLine = start.Line, 75 | iStartIndex = start.Column, 76 | iEndLine = end.Line, 77 | iEndIndex = end.Column 78 | }; 79 | } 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_UnitTests/VSPackage_UnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 2.0 7 | {FCE2853E-11C9-4C68-9766-FF0A281831AF} 8 | Library 9 | Properties 10 | BooProject_UnitTests 11 | BooProject_UnitTests 12 | v4.0 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | Key.snk 34 | 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | {CACB60A9-1E76-4F92-8831-B134A658C695} 71 | Microsoft.VisualStudio.Project 72 | 73 | 74 | {69C291FC-45BC-484D-971F-ABB0BC06D57C} 75 | VSPackage 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /MPFProject/SolutionListenerForProjectEvents.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio; 14 | using Microsoft.VisualStudio.Shell.Interop; 15 | using IServiceProvider = System.IServiceProvider; 16 | 17 | namespace Microsoft.VisualStudio.Project 18 | { 19 | /// 20 | /// This class triggers the project events for "our" hierrachies. 21 | /// 22 | internal class SolutionListenerForProjectEvents : SolutionListener, IProjectEvents 23 | { 24 | #region events 25 | /// Event raised just after the project file opened. 26 | /// 27 | public event EventHandler AfterProjectFileOpened; 28 | 29 | /// 30 | /// Event raised before the project file closed. 31 | /// 32 | public event EventHandler BeforeProjectFileClosed; 33 | #endregion 34 | 35 | #region ctor 36 | internal SolutionListenerForProjectEvents(IServiceProvider serviceProvider) 37 | : base(serviceProvider) 38 | { 39 | } 40 | #endregion 41 | 42 | #region overridden methods 43 | public override int OnAfterOpenProject(IVsHierarchy hierarchy, int added) 44 | { 45 | IProjectEventsListener projectEventListener = hierarchy as IProjectEventsListener; 46 | if(projectEventListener != null && projectEventListener.IsProjectEventsListener) 47 | { 48 | this.RaiseAfterProjectFileOpened((added != 0) ? true : false); 49 | } 50 | 51 | return VSConstants.S_OK; 52 | } 53 | 54 | public override int OnBeforeCloseProject(IVsHierarchy hierarchy, int removed) 55 | { 56 | IProjectEventsListener projectEvents = hierarchy as IProjectEventsListener; 57 | if(projectEvents != null && projectEvents.IsProjectEventsListener) 58 | { 59 | this.RaiseBeforeProjectFileClosed((removed != 0) ? true : false); 60 | } 61 | 62 | return VSConstants.S_OK; 63 | } 64 | #endregion 65 | 66 | #region helpers 67 | /// 68 | /// Raises after project file opened event. 69 | /// 70 | /// True if the project is added to the solution after the solution is opened. false if the project is added to the solution while the solution is being opened. 71 | private void RaiseAfterProjectFileOpened(bool added) 72 | { 73 | // Save event in temporary variable to avoid race condition. 74 | EventHandler tempEvent = this.AfterProjectFileOpened; 75 | if(tempEvent != null) 76 | { 77 | tempEvent(this, new AfterProjectFileOpenedEventArgs(added)); 78 | } 79 | } 80 | 81 | 82 | 83 | 84 | /// 85 | /// Raises the before project file closed event. 86 | /// 87 | /// true if the project was removed from the solution before the solution was closed. false if the project was removed from the solution while the solution was being closed. 88 | private void RaiseBeforeProjectFileClosed(bool removed) 89 | { 90 | // Save event in temporary variable to avoid race condition. 91 | EventHandler tempEvent = this.BeforeProjectFileClosed; 92 | if(tempEvent != null) 93 | { 94 | tempEvent(this, new BeforeProjectFileClosedEventArgs(removed)); 95 | } 96 | } 97 | } 98 | #endregion 99 | } 100 | -------------------------------------------------------------------------------- /VSPackage/VSPackage_UnitTests/MenuItemTests/MenuItemCallback.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Collections; 14 | using System.Text; 15 | using System.Reflection; 16 | using System.ComponentModel.Design; 17 | using Microsoft.VsSDK.UnitTestLibrary; 18 | using Microsoft.VisualStudio.Shell.Interop; 19 | using Microsoft.VisualStudio.TestTools.UnitTesting; 20 | using Microsoft.VisualStudio.Shell; 21 | using Hill30.BooProject; 22 | 23 | namespace BooProject_UnitTests.MenuItemTests 24 | { 25 | [TestClass()] 26 | public class MenuItemTest 27 | { 28 | /// 29 | /// Verify that a new menu command object gets added to the OleMenuCommandService. 30 | /// This action takes place In the Initialize method of the Package object 31 | /// 32 | [TestMethod] 33 | public void InitializeMenuCommand() 34 | { 35 | // Create the package 36 | IVsPackage package = new BooProjectPackage() as IVsPackage; 37 | Assert.IsNotNull(package, "The object does not implement IVsPackage"); 38 | 39 | // Create a basic service provider 40 | OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices(); 41 | 42 | // Site the package 43 | Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK"); 44 | 45 | //Verify that the menu command can be found 46 | CommandID menuCommandID = new CommandID(Hill30.BooProject.Constants.GuidBooProjectCmdSet, (int)PkgCmdIDList.cmdidBooISh); 47 | MethodInfo info = typeof(Package).GetMethod("GetService", BindingFlags.Instance | BindingFlags.NonPublic); 48 | Assert.IsNotNull(info); 49 | OleMenuCommandService mcs = info.Invoke(package, new object[] { (typeof(IMenuCommandService)) }) as OleMenuCommandService; 50 | Assert.IsNotNull(mcs.FindCommand(menuCommandID)); 51 | } 52 | 53 | [TestMethod] 54 | public void MenuItemCallback() 55 | { 56 | // Create the package 57 | IVsPackage package = new BooProjectPackage() as IVsPackage; 58 | Assert.IsNotNull(package, "The object does not implement IVsPackage"); 59 | 60 | // Create a basic service provider 61 | OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices(); 62 | 63 | // Create a UIShell service mock and proffer the service so that it can called from the MenuItemCallback method 64 | BaseMock uishellMock = UIShellServiceMock.GetUiShellInstance(); 65 | serviceProvider.AddService(typeof(SVsUIShell), uishellMock, true); 66 | 67 | // Site the package 68 | Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK"); 69 | 70 | //Invoke private method on package class and observe that the method does not throw 71 | System.Reflection.MethodInfo info = package.GetType().GetMethod("MenuItemCallback", BindingFlags.Instance | BindingFlags.NonPublic); 72 | Assert.IsNotNull(info, "Failed to get the private method MenuItemCallback throug refplection"); 73 | info.Invoke(package, new object[] { null, null }); 74 | 75 | //Clean up services 76 | serviceProvider.RemoveService(typeof(SVsUIShell)); 77 | 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /MPFProject/Misc/UnsafeNativeMethods.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | 15 | namespace Microsoft.VisualStudio.Project 16 | { 17 | internal static class UnsafeNativeMethods 18 | { 19 | [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalLock", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 20 | internal static extern IntPtr GlobalLock(IntPtr h); 21 | 22 | [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalUnlock", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 23 | internal static extern bool GlobalUnLock(IntPtr h); 24 | 25 | [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalSize", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 26 | internal static extern int GlobalSize(IntPtr h); 27 | 28 | [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] 29 | internal static extern int OleSetClipboard(Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject); 30 | 31 | [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] 32 | internal static extern int OleGetClipboard(out Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject); 33 | 34 | [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] 35 | internal static extern int OleFlushClipboard(); 36 | 37 | [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] 38 | internal static extern int OpenClipboard(IntPtr newOwner); 39 | 40 | [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] 41 | internal static extern int EmptyClipboard(); 42 | 43 | [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] 44 | internal static extern int CloseClipboard(); 45 | 46 | [DllImport(ExternDll.Comctl32, CharSet = CharSet.Auto)] 47 | internal static extern int ImageList_GetImageCount(HandleRef himl); 48 | 49 | [DllImport(ExternDll.Comctl32, CharSet = CharSet.Auto)] 50 | internal static extern bool ImageList_Draw(HandleRef himl, int i, HandleRef hdcDst, int x, int y, int fStyle); 51 | 52 | [DllImport(ExternDll.Shell32, EntryPoint = "DragQueryFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 53 | internal static extern uint DragQueryFile(IntPtr hDrop, uint iFile, char[] lpszFile, uint cch); 54 | 55 | [DllImport(ExternDll.User32, EntryPoint = "RegisterClipboardFormatW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 56 | internal static extern ushort RegisterClipboardFormat(string format); 57 | 58 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport(ExternDll.Shell32, EntryPoint = "SHGetSpecialFolderLocation")] 59 | internal static extern int SHGetSpecialFolderLocation(IntPtr hwnd, int csidl, [Out, MarshalAs(UnmanagedType.LPArray)] IntPtr[] ppidl); 60 | 61 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport(ExternDll.Shell32, EntryPoint = "SHGetPathFromIDList", CharSet = System.Runtime.InteropServices.CharSet.Auto)] 62 | internal static extern bool SHGetPathFromIDList(IntPtr pidl, IntPtr pszPath); 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /MPFProject/BuildStatus.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | 13 | 14 | namespace Microsoft.VisualStudio.Project 15 | { 16 | using System; 17 | using System.Diagnostics; 18 | using System.Diagnostics.CodeAnalysis; 19 | using System.Runtime.InteropServices; 20 | using Microsoft.VisualStudio.Shell.Interop; 21 | 22 | /// 23 | /// Provides information about the current build status. 24 | /// 25 | internal static class BuildStatus 26 | { 27 | private static BuildKind? currentBuild; 28 | 29 | private static volatile object Mutex = new object(); 30 | 31 | /// 32 | /// Gets a value whether a build is in progress. 33 | /// 34 | internal static bool IsInProgress 35 | { 36 | get { return BuildStatus.currentBuild.HasValue; } 37 | } 38 | 39 | /// 40 | /// Called when a build has started 41 | /// 42 | /// 43 | /// 44 | public static bool StartBuild(BuildKind kind) 45 | { 46 | if (!BuildStatus.currentBuild.HasValue) 47 | { 48 | lock(BuildStatus.Mutex) 49 | { 50 | BuildStatus.currentBuild = kind; 51 | } 52 | 53 | return true; 54 | } 55 | 56 | BuildKind currentBuildKind = BuildStatus.currentBuild.Value; 57 | 58 | switch (currentBuildKind) 59 | { 60 | case BuildKind.Sync: 61 | // Attempt to start a build during sync build indicate reentrancy 62 | Debug.Fail("Message pumping during sync build"); 63 | return false; 64 | 65 | case BuildKind.Async: 66 | if (kind == BuildKind.Sync) 67 | { 68 | // if we need to do a sync build during async build, there is not much we can do: 69 | // - the async build is user-invoked build 70 | // - during that build UI thread is by design not blocked and messages are being pumped 71 | // - therefore it is legitimate for other code to call Project System APIs and query for stuff 72 | // In that case we just fail gracefully 73 | return false; 74 | } 75 | else 76 | { 77 | // Somebody attempted to start a build while build is in progress, perhaps and Addin via 78 | // the API. Inform them of an error in their ways. 79 | throw new InvalidOperationException("Build is already in progress"); 80 | } 81 | default: 82 | Debug.Fail("Unreachable"); 83 | return false; 84 | 85 | } 86 | } 87 | 88 | /// 89 | /// Called when a build is ended. 90 | /// 91 | internal static void EndBuild() 92 | { 93 | Debug.Assert(IsInProgress, "Attempt to end a build that is not started"); 94 | lock (Mutex) 95 | { 96 | BuildStatus.currentBuild = null; 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /MPFProject/Automation/VSProject/OABuildManager.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | This code is licensed under the Visual Studio SDK license terms. 5 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | 10 | ***************************************************************************/ 11 | 12 | using System; 13 | using Microsoft.VisualStudio.Shell.Interop; 14 | using VSLangProj; 15 | using Microsoft.VisualStudio; 16 | 17 | namespace Microsoft.VisualStudio.Project.Automation 18 | { 19 | public class OABuildManager : ConnectionPointContainer, 20 | IEventSource<_dispBuildManagerEvents>, 21 | BuildManager, 22 | BuildManagerEvents 23 | { 24 | private ProjectNode projectManager; 25 | 26 | public OABuildManager(ProjectNode project) 27 | { 28 | projectManager = project; 29 | AddEventSource<_dispBuildManagerEvents>(this as IEventSource<_dispBuildManagerEvents>); 30 | } 31 | 32 | 33 | #region BuildManager Members 34 | 35 | public virtual string BuildDesignTimeOutput(string bstrOutputMoniker) 36 | { 37 | throw new NotImplementedException(); 38 | } 39 | 40 | public virtual EnvDTE.Project ContainingProject 41 | { 42 | get { return projectManager.GetAutomationObject() as EnvDTE.Project; } 43 | } 44 | 45 | public virtual EnvDTE.DTE DTE 46 | { 47 | get { return projectManager.Site.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; } 48 | } 49 | 50 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] 51 | public virtual object DesignTimeOutputMonikers 52 | { 53 | get { throw new NotImplementedException(); } 54 | } 55 | 56 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] 57 | public virtual object Parent 58 | { 59 | get { throw new NotImplementedException(); } 60 | } 61 | 62 | #endregion 63 | 64 | #region _dispBuildManagerEvents_Event Members 65 | 66 | public event _dispBuildManagerEvents_DesignTimeOutputDeletedEventHandler DesignTimeOutputDeleted; 67 | 68 | public event _dispBuildManagerEvents_DesignTimeOutputDirtyEventHandler DesignTimeOutputDirty; 69 | 70 | #endregion 71 | 72 | #region IEventSource<_dispBuildManagerEvents> Members 73 | 74 | void IEventSource<_dispBuildManagerEvents>.OnSinkAdded(_dispBuildManagerEvents sink) 75 | { 76 | DesignTimeOutputDeleted += new _dispBuildManagerEvents_DesignTimeOutputDeletedEventHandler(sink.DesignTimeOutputDeleted); 77 | DesignTimeOutputDirty += new _dispBuildManagerEvents_DesignTimeOutputDirtyEventHandler(sink.DesignTimeOutputDirty); 78 | } 79 | 80 | void IEventSource<_dispBuildManagerEvents>.OnSinkRemoved(_dispBuildManagerEvents sink) 81 | { 82 | DesignTimeOutputDeleted -= new _dispBuildManagerEvents_DesignTimeOutputDeletedEventHandler(sink.DesignTimeOutputDeleted); 83 | DesignTimeOutputDirty -= new _dispBuildManagerEvents_DesignTimeOutputDirtyEventHandler(sink.DesignTimeOutputDirty); 84 | } 85 | 86 | #endregion 87 | 88 | protected virtual void OnDesignTimeOutputDeleted(string outputMoniker) 89 | { 90 | var handlers = this.DesignTimeOutputDeleted; 91 | if (handlers != null) 92 | { 93 | handlers(outputMoniker); 94 | } 95 | } 96 | 97 | protected virtual void OnDesignTimeOutputDirty(string outputMoniker) 98 | { 99 | var handlers = this.DesignTimeOutputDirty; 100 | if (handlers != null) 101 | { 102 | handlers(outputMoniker); 103 | } 104 | } 105 | } 106 | } 107 | --------------------------------------------------------------------------------