Exemplo n.º 1
0
        private ISemanticModel GetSemanticModel(ITextBuffer buffer)
        {
            if (currentSnapshot == buffer.CurrentSnapshot)
            {
                return(semanticModelCache);
            }

            currentSnapshot = buffer.CurrentSnapshot;


            var code = currentSnapshot.GetText();

            if (buffer.ContentType.TypeName == Constants.TstContentType)
            {
                semanticModelCache = new SemanticModel(shadowClass);
                _codeLexerTst.Tokenize(semanticModelCache, code, GetProjectItem(buffer));
                _templateLexerTst.Tokenize(semanticModelCache, code, buffer.ContentType);
            }
            else
            {
                semanticModelCache = new TstXSemanticModel(shadowClass);
                _codeLexerTstX.Tokenize(semanticModelCache, code, GetProjectItem(buffer));
                _templateLexerTstX.Tokenize(semanticModelCache, code, buffer.ContentType);
            }

            return(semanticModelCache);
        }
Exemplo n.º 2
0
        private SemanticModel GetSemanticModel(ITextBuffer buffer)
        {
            if (currentSnapshot == buffer.CurrentSnapshot)
            {
                return(semanticModelCache);
            }

            currentSnapshot    = buffer.CurrentSnapshot;
            semanticModelCache = new SemanticModel(shadowClass);

            var code = currentSnapshot.GetText();

            codeLexer.Tokenize(semanticModelCache, code, GetProjectItem(buffer));
            templateLexer.Tokenize(semanticModelCache, code);

            return(semanticModelCache);
        }