Exemple #1
0
        public TextBufferStateTracker(ITextBuffer buffer)
        {
            _buffer          = buffer;
            _buffer.Changed += new EventHandler <TextContentChangedEventArgs>(Buffer_Changed);

            _scanner = new ProbeClassifierScanner();

            // First line always has a zero state.
            _states.Add(0);
        }
Exemple #2
0
        public ProbeClassifier(IClassificationTypeRegistryService registry)
        {
            if (_lightTokenTypes == null)
            {
                _lightTokenTypes = new Dictionary <ProbeClassifierType, IClassificationType>();
                _lightTokenTypes[ProbeClassifierType.Normal]        = registry.GetClassificationType("DK.Normal.Light");
                _lightTokenTypes[ProbeClassifierType.Comment]       = registry.GetClassificationType("DK.Comment.Light");
                _lightTokenTypes[ProbeClassifierType.Keyword]       = registry.GetClassificationType("DK.Keyword.Light");
                _lightTokenTypes[ProbeClassifierType.Number]        = registry.GetClassificationType("DK.Number.Light");
                _lightTokenTypes[ProbeClassifierType.StringLiteral] = registry.GetClassificationType("DK.StringLiteral.Light");
                _lightTokenTypes[ProbeClassifierType.Preprocessor]  = registry.GetClassificationType("DK.Preprocessor.Light");
                _lightTokenTypes[ProbeClassifierType.Inactive]      = registry.GetClassificationType("DK.Inactive.Light");
                _lightTokenTypes[ProbeClassifierType.TableName]     = registry.GetClassificationType("DK.TableName.Light");
                _lightTokenTypes[ProbeClassifierType.TableField]    = registry.GetClassificationType("DK.TableField.Light");
                _lightTokenTypes[ProbeClassifierType.Constant]      = registry.GetClassificationType("DK.Constant.Light");
                _lightTokenTypes[ProbeClassifierType.DataType]      = registry.GetClassificationType("DK.DataType.Light");
                _lightTokenTypes[ProbeClassifierType.Function]      = registry.GetClassificationType("DK.Function.Light");
                _lightTokenTypes[ProbeClassifierType.Delimiter]     = registry.GetClassificationType("DK.Delimiter.Light");
                _lightTokenTypes[ProbeClassifierType.Operator]      = registry.GetClassificationType("DK.Operator.Light");
                _lightTokenTypes[ProbeClassifierType.Variable]      = registry.GetClassificationType("DK.Variable.Light");
                _lightTokenTypes[ProbeClassifierType.Interface]     = registry.GetClassificationType("DK.Interface.Light");
            }

            if (_darkTokenTypes == null)
            {
                _darkTokenTypes = new Dictionary <ProbeClassifierType, IClassificationType>();
                _darkTokenTypes[ProbeClassifierType.Normal]        = registry.GetClassificationType("DK.Normal.Dark");
                _darkTokenTypes[ProbeClassifierType.Comment]       = registry.GetClassificationType("DK.Comment.Dark");
                _darkTokenTypes[ProbeClassifierType.Keyword]       = registry.GetClassificationType("DK.Keyword.Dark");
                _darkTokenTypes[ProbeClassifierType.Number]        = registry.GetClassificationType("DK.Number.Dark");
                _darkTokenTypes[ProbeClassifierType.StringLiteral] = registry.GetClassificationType("DK.StringLiteral.Dark");
                _darkTokenTypes[ProbeClassifierType.Preprocessor]  = registry.GetClassificationType("DK.Preprocessor.Dark");
                _darkTokenTypes[ProbeClassifierType.Inactive]      = registry.GetClassificationType("DK.Inactive.Dark");
                _darkTokenTypes[ProbeClassifierType.TableName]     = registry.GetClassificationType("DK.TableName.Dark");
                _darkTokenTypes[ProbeClassifierType.TableField]    = registry.GetClassificationType("DK.TableField.Dark");
                _darkTokenTypes[ProbeClassifierType.Constant]      = registry.GetClassificationType("DK.Constant.Dark");
                _darkTokenTypes[ProbeClassifierType.DataType]      = registry.GetClassificationType("DK.DataType.Dark");
                _darkTokenTypes[ProbeClassifierType.Function]      = registry.GetClassificationType("DK.Function.Dark");
                _darkTokenTypes[ProbeClassifierType.Delimiter]     = registry.GetClassificationType("DK.Delimiter.Dark");
                _darkTokenTypes[ProbeClassifierType.Operator]      = registry.GetClassificationType("DK.Operator.Dark");
                _darkTokenTypes[ProbeClassifierType.Variable]      = registry.GetClassificationType("DK.Variable.Dark");
                _darkTokenTypes[ProbeClassifierType.Interface]     = registry.GetClassificationType("DK.Interface.Dark");
            }

            _scanner = new ProbeClassifierScanner();

            ProbeEnvironment.AppChanged += new EventHandler(ProbeEnvironment_AppChanged);
            ProbeToolsPackage.Instance.EditorOptions.EditorRefreshRequired += EditorOptions_ClassifierRefreshRequired;

            VSTheme.ThemeChanged += VSTheme_ThemeChanged;
        }