Esempio n. 1
0
        internal DafnyClassifier(ITextBuffer buffer,
                                 ITagAggregator <DafnyTokenTag> tagAggregator,
                                 IClassificationTypeRegistryService typeService, Microsoft.VisualStudio.Language.StandardClassification.IStandardClassificationService standards)
        {
            _buffer                  = buffer;
            _aggregator              = tagAggregator;
            _aggregator.TagsChanged += new EventHandler <TagsChangedEventArgs>(_aggregator_TagsChanged);

            // use built-in classification types:
            _typeMap = new Dictionary <DafnyTokenKind, IClassificationType>();
            _typeMap[DafnyTokenKind.Keyword]                      = standards.Keyword;
            _typeMap[DafnyTokenKind.Number]                       = standards.NumberLiteral;
            _typeMap[DafnyTokenKind.String]                       = standards.StringLiteral;
            _typeMap[DafnyTokenKind.Comment]                      = standards.Comment;
            _typeMap[DafnyTokenKind.VariableIdentifier]           = standards.Identifier;
            _typeMap[DafnyTokenKind.AdditionalInformation]        = standards.Other;
            _typeMap[DafnyTokenKind.VariableIdentifierDefinition] = typeService.GetClassificationType("Dafny identifier");

            if (DafnyMenuPackage == null)
            {
                // Initialize the Dafny menu.
                var shell = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShell)) as Microsoft.VisualStudio.Shell.Interop.IVsShell;
                if (shell != null)
                {
                    Microsoft.VisualStudio.Shell.Interop.IVsPackage package = null;
                    Guid PackageToBeLoadedGuid = new Guid("e1baf989-88a6-4acf-8d97-e0dc243476aa");
                    if (shell.LoadPackage(ref PackageToBeLoadedGuid, out package) == Microsoft.VisualStudio.VSConstants.S_OK)
                    {
                        DafnyMenuPackage           = (DafnyMenu.DafnyMenuPackage)package;
                        DafnyMenuPackage.MenuProxy = new MenuProxy(DafnyMenuPackage);
                    }
                }
            }
        }
Esempio n. 2
0
 public MenuProxy(DafnyMenu.DafnyMenuPackage DafnyMenuPackage)
 {
     this.DafnyMenuPackage = DafnyMenuPackage;
 }
Esempio n. 3
0
 public MenuProxy(DafnyMenu.DafnyMenuPackage DafnyMenuPackage)
 {
   this.DafnyMenuPackage = DafnyMenuPackage;
 }