Пример #1
0
        public void ParseModeline(int numLine)
        {
            ITextBuffer buffer   = this.theView.TextBuffer;
            var         snapshot = buffer.CurrentSnapshot;

            if (snapshot.LineCount <= numLine)
            {
                return;
            }
            ILanguage language = langFactory.TryCreateLanguage(snapshot);

            if (language == null)
            {
                return;
            }

            var firstLine = snapshot.GetLineFromLineNumber(numLine);

            ITextChars tc          = new LineChars(firstLine);
            String     commentText = language.NewFirstLineCommentParser().Parse(tc);

            if (String.IsNullOrEmpty(commentText))
            {
                return;
            }
            VsfPackage.LogInfo("Found possible modeline: {0}", commentText);

            var modelineParser = new ModeLineParser();
            var options        = modelineParser.Parse(commentText);

            ApplyModelines(options);
        }
Пример #2
0
        public void ParseModeline(int numLine)
        {
            ITextBuffer buffer   = this.theView.TextBuffer;
            var         snapshot = buffer.CurrentSnapshot;

            if (snapshot.LineCount <= numLine)
            {
                return;
            }
            ILanguage language = this.langFactory.TryCreateLanguage(snapshot);

            if (language == null)
            {
                return;
            }

            var firstLine = snapshot.GetLineFromLineNumber(numLine);

            ITextChars tc          = new LineChars(firstLine);
            var        svc         = language.GetService <IFirstLineCommentParser>();
            String     commentText = svc.Parse(tc);

            if (String.IsNullOrEmpty(commentText))
            {
                return;
            }

            var modelineParser = new ModeLineParser();
            var options        = modelineParser.Parse(commentText);

            ApplyModelines(options);
        }