diff options
author | Miguel Costa <miguel.costa@qt.io> | 2018-06-05 15:56:53 +0200 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2018-06-20 08:15:27 +0000 |
commit | 4c9eb3cd819a158e2387815060a9880401e1962f (patch) | |
tree | e863353a5702d2e8246d6c4728d8eae32e5dfa81 | |
parent | c11c7e04c5627f90e8bf31bb180d5b4d2371ceba (diff) |
Disable previous QML syntax highlighting
Disabled the QML syntax highlighting previously in use. This is now
superseded by the new syntax highlighting integrated with the Qt
Declarative parser.
Task-number: QTVSADDINBUG-501
Change-Id: I5f2567f0d1db4038df73e15219ea7363ab65da99
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/QtVsTools.sln | 7 | ||||
-rw-r--r-- | src/qttmlanguage/qml/LICENSE.MIT | 21 | ||||
-rw-r--r-- | src/qttmlanguage/qml/qml.qmlproject.tmLanguage | 317 | ||||
-rw-r--r-- | src/qtvstools/Classifier.cs | 518 | ||||
-rw-r--r-- | src/qtvstools/ClassifierClassificationDefinition.cs | 48 | ||||
-rw-r--r-- | src/qtvstools/ClassifierDefinitions.cs | 185 | ||||
-rw-r--r-- | src/qtvstools/ClassifierProvider.cs | 64 | ||||
-rw-r--r-- | src/qtvstools/ClassifierTypes.cs | 43 | ||||
-rw-r--r-- | src/qtvstools/CommentToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/ContentTypeDefinition.cs | 64 | ||||
-rw-r--r-- | src/qtvstools/JsKeywordToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/KeywordToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/MultilineCommentToken.cs | 71 | ||||
-rw-r--r-- | src/qtvstools/OtherToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/PropertyToken.cs | 43 | ||||
-rw-r--r-- | src/qtvstools/QtVsTools.csproj | 16 | ||||
-rw-r--r-- | src/qtvstools/StringToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/Token.cs | 44 | ||||
-rw-r--r-- | src/qtvstools/TokenType.cs | 45 | ||||
-rw-r--r-- | src/qtvstools/TypeToken.cs | 40 | ||||
-rw-r--r-- | src/qtvstools/Vsix.cs | 8 |
21 files changed, 8 insertions, 1726 deletions
diff --git a/src/QtVsTools.sln b/src/QtVsTools.sln index af893316..9d3a7522 100644 --- a/src/QtVsTools.sln +++ b/src/QtVsTools.sln @@ -75,12 +75,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DialogButtonRight", "qttemp EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language", "Language", "{AE9DC593-DC68-45D2-9A96-E80A7CF3BA7F}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "qml", "qml", "{13D9BD91-CA66-4D80-A238-BB07176F994F}" - ProjectSection(SolutionItems) = preProject - qttmlanguage\qml\LICENSE.MIT = qttmlanguage\qml\LICENSE.MIT - qttmlanguage\qml\qml.qmlproject.tmLanguage = qttmlanguage\qml\qml.qmlproject.tmLanguage - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "qt", "qt", "{62102FDD-016A-4FEC-B73C-808C7B1C7AA5}" ProjectSection(SolutionItems) = preProject qttmlanguage\qt\LICENSE = qttmlanguage\qt\LICENSE @@ -168,7 +162,6 @@ Global {20055427-1352-44FB-8442-BF7F15F9C59E} = {D73514C8-019E-44FB-8D42-F1FD52C1FD72} {F7407750-5F72-460F-9C53-27CF509A39B1} = {D73514C8-019E-44FB-8D42-F1FD52C1FD72} {F2166B59-E41B-4328-B31D-9E2B9AC5A59C} = {D73514C8-019E-44FB-8D42-F1FD52C1FD72} - {13D9BD91-CA66-4D80-A238-BB07176F994F} = {AE9DC593-DC68-45D2-9A96-E80A7CF3BA7F} {62102FDD-016A-4FEC-B73C-808C7B1C7AA5} = {AE9DC593-DC68-45D2-9A96-E80A7CF3BA7F} EndGlobalSection EndGlobal diff --git a/src/qttmlanguage/qml/LICENSE.MIT b/src/qttmlanguage/qml/LICENSE.MIT deleted file mode 100644 index d7d49aa1..00000000 --- a/src/qttmlanguage/qml/LICENSE.MIT +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 bbenoist - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/qttmlanguage/qml/qml.qmlproject.tmLanguage b/src/qttmlanguage/qml/qml.qmlproject.tmLanguage deleted file mode 100644 index 9c75555f..00000000 --- a/src/qttmlanguage/qml/qml.qmlproject.tmLanguage +++ /dev/null @@ -1,317 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> - <dict> - <key>fileTypes</key> - <array> - <string>qml</string> - <string>qmlproject</string> - </array> - <key>name</key> - <string>QML</string> - <key>patterns</key> - <array> - <dict> - <key>begin</key> - <string>/\*(?!/)</string> - <key>comment</key> - <string>Block comment.</string> - <key>end</key> - <string>\*/</string> - <key>name</key> - <string>comment.block.documentation.qml</string> - </dict> - <dict> - <key>comment</key> - <string>Line comment.</string> - <key>match</key> - <string>//.*$</string> - <key>name</key> - <string>comment.line.double-slash.qml</string> - </dict> - <dict> - <key>begin</key> - <string>\b(import)\s+</string> - <key>beginCaptures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>keyword.other.import.qml</string> - </dict> - </dict> - <key>comment</key> - <string>import statement.</string> - <key>end</key> - <string>$</string> - <key>name</key> - <string>meta.import.qml</string> - <key>patterns</key> - <array> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>entity.name.class.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>constant.numeric.qml</string> - </dict> - <key>3</key> - <dict> - <key>name</key> - <string>keyword.other.import.qml</string> - </dict> - <key>4</key> - <dict> - <key>name</key> - <string>entity.name.class.qml</string> - </dict> - </dict> - <key>comment</key> - <string>import Namespace VersionMajor.VersionMinor [as SingletonTypeIdentifier]</string> - <key>match</key> - <string>([\w\d\.]+)\s+(\d+\.\d+)(?:\s+(as)\s+([A-Z][\w\d]*))?</string> - <key>name</key> - <string>meta.import.namespace.qml</string> - </dict> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>string.quoted.double.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>keyword.other.import.qml</string> - </dict> - <key>3</key> - <dict> - <key>name</key> - <string>entity.name.class.qml</string> - </dict> - </dict> - <key>comment</key> - <string>import <string> [as Script]</string> - <key>match</key> - <string>(\"[^\"]+\")(?:\s+(as)\s+([A-Z][\w\d]*))?</string> - <key>name</key> - <string>meta.import.dirjs.qml</string> - </dict> - </array> - </dict> - <dict> - <key>comment</key> - <string>Capitalized word (class or enum).</string> - <key>match</key> - <string>\b[A-Z]\w*\b</string> - <key>name</key> - <string>support.class.qml</string> - </dict> - <dict> - <key>comment</key> - <string>onSomething - handler.</string> - <key>match</key> - <string>(((^|\{)\s*)|\b)on[A-Z]\w*\b</string> - <key>name</key> - <string>support.class.qml</string> - </dict> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>keyword.other.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>storage.modifier.qml</string> - </dict> - </dict> - <key>comment</key> - <string>id: <something></string> - <key>match</key> - <string>(?:^|\{)\s*(id)\s*\:\s*([^;\s]+)\b</string> - <key>name</key> - <string>meta.id.qml</string> - </dict> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>keyword.other.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>keyword.other.qml</string> - </dict> - <key>3</key> - <dict> - <key>name</key> - <string>keyword.other.qml</string> - </dict> - <key>4</key> - <dict> - <key>name</key> - <string>storage.type.qml</string> - </dict> - <key>5</key> - <dict> - <key>name</key> - <string>entity.other.attribute-name.qml</string> - </dict> - </dict> - <key>comment</key> - <string>property definition.</string> - <key>match</key> - <string>^\s*(?:(default|readonly)\s+)?(property)\s+(?:(alias)|([\w\<\>]+))\s+(\w+)</string> - <key>name</key> - <string>meta.propertydef.qml</string> - </dict> - <dict> - <key>begin</key> - <string>\b(signal)\s+(\w+)\s*</string> - <key>beginCaptures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>keyword.other.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>support.function.qml</string> - </dict> - </dict> - <key>comment</key> - <string>signal <signalName>[([<type> <parameter>[, ...]])]</string> - <key>end</key> - <string>;|(?=/)|$</string> - <key>name</key> - <string>meta.signal.qml</string> - <key>patterns</key> - <array> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>storage.type.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>variable.parameter.qml</string> - </dict> - </dict> - <key>match</key> - <string>(\w+)\s+(\w+)</string> - <key>name</key> - <string>meta.signal.parameters.qml</string> - </dict> - </array> - </dict> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>constant.language.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>storage.type.qml</string> - </dict> - <key>3</key> - <dict> - <key>name</key> - <string>keyword.control.qml</string> - </dict> - </dict> - <key>comment</key> - <string>js keywords.</string> - <key>match</key> - <string>(?:\b|\s+)(?:(true|false|null|undefined)|(var|void)|(on|as|enum|connect|break|case|catch|continue|debugger|default|delete|do|else|finally|for|if|in|instanceof|new|return|switch|this|throw|try|typeof|while|with))\b</string> - <key>name</key> - <string>meta.keyword.qml</string> - </dict> - <dict> - <key>captures</key> - <dict> - <key>1</key> - <dict> - <key>name</key> - <string>storage.type.qml</string> - </dict> - <key>2</key> - <dict> - <key>name</key> - <string>entity.name.function.untitled</string> - </dict> - </dict> - <key>comment</key> - <string>function definition.</string> - <key>match</key> - <string>\b(function)\s+([\w_]+)\s*(?=\()</string> - <key>name</key> - <string>meta.function.qml</string> - </dict> - <dict> - <key>comment</key> - <string>function call.</string> - <key>match</key> - <string>\b[\w_]+\s*(?=\()</string> - <key>name</key> - <string>support.function.qml</string> - </dict> - <dict> - <key>comment</key> - <string>property (property: <something>).</string> - <key>match</key> - <string>(?:^|\{|;)\s*[a-z][\w\.]*\s*(?=\:)</string> - <key>name</key> - <string>entity.other.attribute-name.qml</string> - </dict> - <dict> - <key>comment</key> - <string>property of the variable (name.property).</string> - <key>match</key> - <string>(?<=\.)\b\w*</string> - <key>name</key> - <string>entity.other.attribute-name.qml</string> - </dict> - <dict> - <key>comment</key> - <string>All non colored words are assumed to be variables.</string> - <key>match</key> - <string>\b([a-z_]\w*)\b</string> - <key>name</key> - <string>variable.parameter</string> - </dict> - <dict> - <key>include</key> - <string>source.js</string> - </dict> - </array> - <key>scopeName</key> - <string>source.qml</string> - <key>uuid</key> - <string>13a281e0-0507-45b4-bb6c-a57177630f10</string> - </dict> -</plist> diff --git a/src/qtvstools/Classifier.cs b/src/qtvstools/Classifier.cs deleted file mode 100644 index 5a57ba6b..00000000 --- a/src/qtvstools/Classifier.cs +++ /dev/null @@ -1,518 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using QtProjectLib; -using Microsoft.VisualStudio.Settings; -using Microsoft.VisualStudio.Shell.Settings; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Classification; -using System; -using System.Collections.Generic; - -namespace QtVsTools -{ - /// <summary> - /// Classifier that classifies all text as an instance of the OrinaryClassifierType - /// </summary> - internal class Classifier : IClassifier - { - // Multi-line comments need some extra care - protected List<MultilineCommentToken> multiLineCommentTokens; - - protected List<string> keywords; // Qml keywords - protected List<string> jsKeywords; // Javascript keywords - protected List<string> types; // Qml types - protected List<string> properties; // Qml keyword 'property xxx' - - protected List<char> separators; - protected char[] whiteSpaceChars; - - readonly bool QmlClassifierEnabled; - - //#pragma warning disable 67 - // This event gets raised if a non-text change would affect the classification in some way, - // for example typing /* would cause the classification to change in C# without directly - // affecting the span. - public event EventHandler<ClassificationChangedEventArgs> ClassificationChanged; - //#pragma warning restore 67 - readonly IClassificationTypeRegistryService classificationRegistryService; - - internal Classifier(IClassificationTypeRegistryService registry, IServiceProvider isp) - { - classificationRegistryService = registry; - multiLineCommentTokens = new List<MultilineCommentToken>(); - - var settingsManager = new ShellSettingsManager(isp); - var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings); - QmlClassifierEnabled = store.GetBoolean(Statics.QmlClassifierPath, - Statics.QmlClassifierKey, true); - - whiteSpaceChars = new[] { ' ', '\t' }; - separators = new List<char> - { - ' ', '\t', - ';', ':', - ',', '.', - '{', '}', - '[', ']', - '(', ')', - '=' - }; - - keywords = new List<string> - { - "property", - "alias", - "signal", - "readonly", - "import", - "on" - }; - - properties = new List<string> - { - "property action", - "property bool", - "property color", - "property date", - "property double", - "property enumeration", - "property font", - "property int", - "property list", - "property point", - "property real", - "property rect", - "property size", - "property string", - "property time", - "property url", - "property variant", - "property var", - "property vector3d" - }; - - jsKeywords = new List<string> - { - "break", - "case", - "catch", - "continue", - "debugger", - "default", - "delete", - "do", - "else", - "finally", - "for", - "function", - "if", - "in", - "instanceof", - "new", - "return", - "switch", - "this", - "throw", - "try", - "typeof", - "var", - "void", - "while", - "with" - }; - - types = new List<string> - { - /* TODO - "action", - "bool", - "color", - "date", - "double", - "enumeration", - "font", - "int", - "list", - "point", - "real", - "rect", - "size", - "string", - "time", - "url", - "variant", - "var", - "vector3d", - * */ - }; - - } - - private void OnClassificationChanged(SnapshotSpan changeSpan) - { - if (ClassificationChanged != null) - ClassificationChanged(this, new ClassificationChangedEventArgs(changeSpan)); - } - - // Re-classify given span - protected void Invalidate(SnapshotSpan span) - { - if (ClassificationChanged != null) - ClassificationChanged(this, new ClassificationChangedEventArgs(span)); - } - - protected Token GetMultiLineCommentToken(string text, int index, int length) - { - var indexOf = text.IndexOf("*/", index, StringComparison.OrdinalIgnoreCase); - return new MultilineCommentToken - { - ContinueParsing = (indexOf == -1), - Length = ((indexOf == -1) ? length - index : indexOf - index + 2) // "*/".Length - }; - } - - protected Token GetStringToken(string text, int index, int length) - { - var indexOf = text.IndexOf('"', index + 1); - return new StringToken - { - ContinueParsing = (indexOf == -1), - Length = ((indexOf == -1) ? length - index : indexOf - index + 1) // '"'.Length - }; - } - - protected Token GetToken(string word, bool colonComing = false, string following = "") - { - if (jsKeywords.Contains(word)) - return new JsKeywordToken(); - - if (keywords.Contains(word)) { - if (colonComing) - return new OtherToken(); - - following = following.TrimStart(whiteSpaceChars); - if (following.Length > 0 && following[0] == ':') - return new OtherToken(); - - return new KeywordToken(); - } - - if (properties.Contains(word)) - return new PropertyToken(); - - if (types.Contains(word)) - return new TypeToken(); - - return new OtherToken(); - } - - protected Token Scan(string text, int index, int length, TokenType tokenType = TokenType.None, - bool continueParsing = false) - { - // End of multi-line comment not reached yet, so find it. - if (tokenType == TokenType.MultilineComment && continueParsing) - return GetMultiLineCommentToken(text, index, length); - - // Special case for finding property stuff - if (text.Substring(index).StartsWith("property ", StringComparison.Ordinal)) { - var possibly_property_type = text.Substring(index, length - index); - var value_len = 0; - try { - foreach (var value in properties) { - if (possibly_property_type.StartsWith(value, StringComparison.Ordinal)) { - if (possibly_property_type.Length == value.Length) { - // Same length --> match - value_len = value.Length; - break; - } - var ch = possibly_property_type[value.Length]; - if (ch == ' ' || ch == '\r' || ch == '\n') { - // Space or line break --> match - value_len = value.Length; - break; - } - } - } - if (value_len > 0) { - var token = new PropertyToken(); - token.Length = value_len; - return token; - } - } catch (IndexOutOfRangeException) { - // pass - } - - } - - var inMultilineComment = false; - for (var i = index; i < length; i++) { - var ch = text[i]; - - var next_ch = '\0'; // doesn't matter which the default is until not '*' or '/' - try { - next_ch = text[i + 1]; - } catch (IndexOutOfRangeException) { - // pass - } - // If we are in beginning of search and not inside multi-line comment parsing - if (i == index && !inMultilineComment) { - if (ch == '\r' || ch == '\n') - continue; - - // If string start found, read rest of it - if (ch == '\"') { - return GetStringToken(text, index, length); - } - // Single line comment start found, - if (ch == '/' && next_ch == '/') { - // One line comment starting - var token = new CommentToken(); - token.Length = length - index; - return token; - } - // Cut now ?? - if (separators.Contains(ch)) { - var token = new OtherToken(); - token.Length = 1; - return token; - } - if (ch == '/' && next_ch == '*') { - // Multi-line comment start found (can be one liner also) - var token = GetMultiLineCommentToken(text, i, length); - if (!token.ContinueParsing) - return new CommentToken { Length = token.Length }; - inMultilineComment = true; - } - } - // Cut now if string starting next - if (separators.Contains(ch) && next_ch == '\"' && !inMultilineComment) { - Token token = null; - var tmp = text.Substring(index, i - index); - token = GetToken(tmp); - token.Length = i - index; - return token; - } - if (separators.Contains(ch)) { - Token token = null; - if (inMultilineComment) { - token = new MultilineCommentToken(); - token.ContinueParsing = true; - } else { - var tmp = text.Substring(index, i - index); - var follows = text.Substring(index + tmp.Length); - token = GetToken(tmp, ch == ':' || next_ch == ':', follows); - } - token.Length = i - index; - return token; - } - if (ch == '\r' || ch == '\n') { - Token token = null; - if (inMultilineComment) { - token = new MultilineCommentToken(); - token.ContinueParsing = true; - } else { - token = GetToken(text.Substring(index, i - index)); - } - token.Length = i - index + 1; - return token; - } - // There is a comment coming so this token ends now - if (ch == '/' && next_ch == '/') { - Token token = null; - token = GetToken(text.Substring(index, i - index)); - token.Length = i - index; // +1; - return token; - } - // Multi-line comment start found (or sure can be one liner also) - // so this token ends now - if (ch == '/' && next_ch == '*') { - // Multi-line comment starting, perhaps - inMultilineComment = true; - var tmp = text.Substring(index, i - index); - tmp = tmp.Trim(); - if (tmp.Length != 0) { - if (jsKeywords.Contains(tmp)) { - var token = new JsKeywordToken(); - token.Length = index + i; - return token; - } else { - var token = new OtherToken(); - token.Length = i - index; - return token; - } - } - } - } - - // End not found yet - if (inMultilineComment) { - var token = new MultilineCommentToken(); - token.Length = length - index; - token.ContinueParsing = true; - return token; - } else { - var tmp = text.Substring(index, length - index); - char[] trimChars = { ' ', ';' }; - tmp = tmp.Trim(trimChars); - if (jsKeywords.Contains(tmp)) { - var token = new JsKeywordToken(); - token.Length = length - index; - return token; - } - } - - var ret = new OtherToken(); - ret.Length = length - index; - return ret; - } - - /// <summary> - /// This method scans the given SnapshotSpan for potential matches for this classification. - /// In this instance, it classifies everything and returns each span as a new ClassificationSpan. - /// </summary> - /// <param name="span">The span currently being classified</param> - /// <returns>A list of ClassificationSpans that represent spans identified to be of this classification</returns> - IList<ClassificationSpan> IClassifier.GetClassificationSpans(SnapshotSpan span) - { - // create a list to hold the results - var classifications = new List<ClassificationSpan>(); - if (!QmlClassifierEnabled) - return classifications; - - var insideMultiLineComment = false; - // Scan all known multi-line comments to check if incoming span intersects - for (var i = multiLineCommentTokens.Count - 1; i >= 0; i--) { - var multilineSpan = multiLineCommentTokens[i].Tracking().GetSpan(span.Snapshot); - if (multilineSpan.Length != 0) { - if (span.IntersectsWith(multilineSpan)) { - // Check if multi-line comment is changed - if (span.Snapshot.Version != multiLineCommentTokens[i].Version()) { - // re-classify multi-line span - multiLineCommentTokens.RemoveAt(i); - Invalidate(multilineSpan); - } else { - insideMultiLineComment = true; - // re-classify multi-line span using current classification - classifications.Add(new ClassificationSpan(multilineSpan, - multiLineCommentTokens[i].Classification())); - } - } - } else { - multiLineCommentTokens.RemoveAt(i); - } - } - - if (!insideMultiLineComment) { - var start = 0; - var end = 0; - var offset = 0; - var text = span.GetText(); - - Token token = null; - do { - start = span.Start.Position + offset; - end = start; - - token = Scan(text, offset, text.Length); - if (token != null) { - end = start + token.Length; - // If token not ending in the current span, continue reading text - // until the whole token is read - while (end < span.Snapshot.Length && token != null && token.ContinueParsing) { - var bufferSize = Math.Min(span.Snapshot.Length - end, 2048); - text = span.Snapshot.GetText(end, bufferSize); - // Scan next token, continuing from previous - token = Scan(text, 0, text.Length, token.Type, token.ContinueParsing); - if (token != null) - end += token.Length; - } - // Add new classification - var tokenSpan = new SnapshotSpan(span.Snapshot, start, (end - start)); - var classification = GetClassificationType(token); - classifications.Add(new ClassificationSpan(tokenSpan, classification)); - - // If we have multi-line comment in out hands add it into the list - if (token.Type == TokenType.MultilineComment) { - var alreadyFound = false; - foreach (var mlToken in multiLineCommentTokens) { - if (mlToken.Tracking().GetSpan(span.Snapshot).Span == tokenSpan.Span) { - alreadyFound = true; - break; - } - } - if (!alreadyFound) { - multiLineCommentTokens.Add(new MultilineCommentToken(classification, - span.Snapshot.CreateTrackingSpan(tokenSpan.Span, - SpanTrackingMode.EdgeExclusive), span.Snapshot.Version)); - // If token text longer than current span do re-classify - if (tokenSpan.End > span.End) - Invalidate(new SnapshotSpan(span.End + 1, tokenSpan.End)); - } - } - offset += (end - start); - } - } - while (token != null && offset < text.Length); - } - return classifications; - } - - private IClassificationType GetClassificationType(Token token) - { - var classifierType = string.Empty; - switch (token.Type) { - case TokenType.MultilineComment: - case TokenType.Comment: - classifierType = ClassifierTypes.Comment; - break; - case TokenType.Keyword: - classifierType = ClassifierTypes.Keyword; - break; - case TokenType.JsKeyword: - classifierType = ClassifierTypes.JsKeyword; - break; - case TokenType.Type: - classifierType = ClassifierTypes.Type; - break; - case TokenType.String: - classifierType = ClassifierTypes.String; - break; - case TokenType.Other: - classifierType = ClassifierTypes.Other; - break; - case TokenType.Property: - classifierType = ClassifierTypes.Property; - break; - } - return classificationRegistryService.GetClassificationType(classifierType); - } - } -} -#endif diff --git a/src/qtvstools/ClassifierClassificationDefinition.cs b/src/qtvstools/ClassifierClassificationDefinition.cs deleted file mode 100644 index f73a5f7b..00000000 --- a/src/qtvstools/ClassifierClassificationDefinition.cs +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Text.Classification; -using Microsoft.VisualStudio.Utilities; -using System.ComponentModel.Composition; - -namespace QtVsTools -{ - internal static class ClassifierClassificationDefinition - { -#pragma warning disable 649 /// Disable "Field is never assigned to..." compiler's warning. - /// <summary> - /// Defines the "QmlClassifier" classification type. - /// </summary> - [Export(typeof(ClassificationTypeDefinition))] - [Name("QmlClassifier")] - internal static ClassificationTypeDefinition QmlClassifierType; -#pragma warning restore 649 /// Justification: the field is assigned by MEF. - } -} -#endif diff --git a/src/qtvstools/ClassifierDefinitions.cs b/src/qtvstools/ClassifierDefinitions.cs deleted file mode 100644 index 26c97ee0..00000000 --- a/src/qtvstools/ClassifierDefinitions.cs +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Text.Classification; -using Microsoft.VisualStudio.Utilities; -using System.ComponentModel.Composition; -using System.Windows.Media; - -namespace QtVsTools -{ - class ClassifierDefinitions - { - [Name(ClassifierTypes.Comment), Export] - internal ClassificationTypeDefinition CommentClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.Comment)] - [Name("CommentFormatDefinition")] - [Order] - internal sealed class CommentFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "Comment" classification type - /// </summary> - internal CommentFormatDefinition() - { - // ARGB value: #FF008000 - ForegroundColor = Colors.Green; - DisplayName = "QML Comment"; //human readable version of the name - } - } - - [Name(ClassifierTypes.Keyword), Export] - internal ClassificationTypeDefinition KeywordClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.Keyword)] - [Name("KeywordFormatDefinition")] - [Order] - internal sealed class KeywordFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "Keyword" classification type - /// </summary> - internal KeywordFormatDefinition() - { - // ARGB value: #FF808000 - ForegroundColor = Colors.Olive; - DisplayName = "QML Keyword"; //human readable version of the name - } - } - - [Name(ClassifierTypes.Property), Export] - internal ClassificationTypeDefinition PropertyClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.Property)] - [Name("PropertyFormatDefinition")] - [Order] - internal sealed class PropertyFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "Property" classification type - /// </summary> - internal PropertyFormatDefinition() - { - // ARGB value: #FF808000 - ForegroundColor = Colors.Olive; - DisplayName = "QML Property"; //human readable version of the name - } - } - - [Name(ClassifierTypes.JsKeyword), Export] - internal ClassificationTypeDefinition JsKeywordClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.JsKeyword)] - [Name("JsKeywordFormatDefinition")] - [Order] - internal sealed class JsKeywordFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "JS Keyword" classification type - /// </summary> - internal JsKeywordFormatDefinition() - { - // ARGB value: #FF808000 - ForegroundColor = Colors.Olive; - DisplayName = "QML JS Keyword"; //human readable version of the name - } - } - - [Name(ClassifierTypes.Type), Export] - internal ClassificationTypeDefinition TypeClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.Type)] - [Name("TypeFormatDefinition")] - [Order] - internal sealed class TypeFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "Type" classification type - /// </summary> - internal TypeFormatDefinition() - { - // ARGB value: #FF800080 - ForegroundColor = Colors.Purple; - DisplayName = "QML Type"; //human readable version of the name - } - } - - [Name(ClassifierTypes.String), Export] - internal ClassificationTypeDefinition StringClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.String)] - [Name("StringFormatDefinition")] - [Order] - internal sealed class StringFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "String" classification type - /// </summary> - internal StringFormatDefinition() - { - // ARGB value: #FF800000 - ForegroundColor = Colors.Maroon; - DisplayName = "QML String"; //human readable version of the name - } - } - - [Name(ClassifierTypes.Other), Export] - internal ClassificationTypeDefinition OtherClassifierType { get; set; } - - [Export(typeof(EditorFormatDefinition))] - [UserVisible(true)] - [ClassificationType(ClassificationTypeNames = ClassifierTypes.Other)] - [Name("OtherFormatDefinition")] - [Order] - internal sealed class OtherFormatDefinition : ClassificationFormatDefinition - { - /// <summary> - /// Defines the visual format for the "Other" classification type - /// </summary> - internal OtherFormatDefinition() - { - DisplayName = "QML Other"; //human readable version of the name - } - } - } -} -#endif diff --git a/src/qtvstools/ClassifierProvider.cs b/src/qtvstools/ClassifierProvider.cs deleted file mode 100644 index eebc3316..00000000 --- a/src/qtvstools/ClassifierProvider.cs +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Classification; -using Microsoft.VisualStudio.Utilities; -using System.ComponentModel.Composition; - -namespace QtVsTools -{ - /// <summary> - /// This class causes a classifier to be added to the set of classifiers. - /// </summary> - [Export(typeof(IClassifierProvider))] - [ContentType(QmlContentTypeDefinition.ContentType)] - internal class ClassifierProvider : IClassifierProvider - { - [Import(typeof(SVsServiceProvider))] - System.IServiceProvider ServiceProvider { get; set; } - - /// <summary> - /// Import the classification registry to be used for getting a reference to the custom - /// classification type later. - /// </summary> - [Import] - IClassificationTypeRegistryService classificationRegistry { get; set; } - - IClassifier IClassifierProvider.GetClassifier(ITextBuffer buffer) - { - return buffer.Properties.GetOrCreateSingletonProperty(() => - { - return new Classifier(classificationRegistry, ServiceProvider); - }); - } - } -} -#endif diff --git a/src/qtvstools/ClassifierTypes.cs b/src/qtvstools/ClassifierTypes.cs deleted file mode 100644 index a19d52a9..00000000 --- a/src/qtvstools/ClassifierTypes.cs +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - class ClassifierTypes - { - internal const string Comment = "Comment_qml"; - internal const string Type = "Type_qml"; - internal const string Keyword = "Keyword_qml"; - internal const string JsKeyword = "JsKeyword_qml"; - internal const string String = "String_qml"; - internal const string Other = "Other_qml"; - internal const string Property = "Property_qml"; - } -} -#endif diff --git a/src/qtvstools/CommentToken.cs b/src/qtvstools/CommentToken.cs deleted file mode 100644 index 8d353471..00000000 --- a/src/qtvstools/CommentToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class CommentToken : Token - { - public CommentToken() - : base(TokenType.Comment) - { - } - } -} -#endif diff --git a/src/qtvstools/ContentTypeDefinition.cs b/src/qtvstools/ContentTypeDefinition.cs deleted file mode 100644 index 4c017939..00000000 --- a/src/qtvstools/ContentTypeDefinition.cs +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Utilities; -using System.ComponentModel.Composition; - -namespace QtVsTools -{ - public sealed class QmlContentTypeDefinition - { - public const string ContentType = "Qml"; - - /// <summary> - /// Exports the Qml content type - /// </summary> - [Export(typeof(ContentTypeDefinition))] - [Name(ContentType)] - [BaseDefinition("code")] - public ContentTypeDefinition QmlContentType { get; set; } - - /// <summary> - /// Exports the Qml file extension - /// </summary> - [Export(typeof(FileExtensionToContentTypeDefinition))] - [ContentType(ContentType)] - [FileExtension(".qml")] - public FileExtensionToContentTypeDefinition QmlFileExtension { get; set; } - - /// <summary> - /// Exports the Qml project file extension - /// </summary> - [Export(typeof(FileExtensionToContentTypeDefinition))] - [ContentType(ContentType)] - [FileExtension(".qmlproject")] - public FileExtensionToContentTypeDefinition QmlProjectFileExtension { get; set; } - } -} -#endif diff --git a/src/qtvstools/JsKeywordToken.cs b/src/qtvstools/JsKeywordToken.cs deleted file mode 100644 index 0cc34b19..00000000 --- a/src/qtvstools/JsKeywordToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class JsKeywordToken : Token - { - public JsKeywordToken() - : base(TokenType.JsKeyword) - { - } - } -} -#endif diff --git a/src/qtvstools/KeywordToken.cs b/src/qtvstools/KeywordToken.cs deleted file mode 100644 index dea6680e..00000000 --- a/src/qtvstools/KeywordToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class KeywordToken : Token - { - public KeywordToken() - : base(TokenType.Keyword) - { - } - } -} -#endif diff --git a/src/qtvstools/MultilineCommentToken.cs b/src/qtvstools/MultilineCommentToken.cs deleted file mode 100644 index c7d253ff..00000000 --- a/src/qtvstools/MultilineCommentToken.cs +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Classification; - -namespace QtVsTools -{ - public class MultilineCommentToken : Token - { - //Classification used th token - protected IClassificationType classificationType; - //Tracked span of token - protected ITrackingSpan trackingSpan; - //Version of text when Tracking was created - protected ITextVersion textVersion; - - public MultilineCommentToken() - : base(TokenType.MultilineComment) - { - } - - public MultilineCommentToken(IClassificationType type, ITrackingSpan span, ITextVersion version) - : base(TokenType.MultilineComment) - { - classificationType = type; - trackingSpan = span; - textVersion = version; - } - - public IClassificationType Classification() - { - return classificationType; - } - public ITrackingSpan Tracking() - { - return trackingSpan; - } - public ITextVersion Version() - { - return textVersion; - } - } -} -#endif diff --git a/src/qtvstools/OtherToken.cs b/src/qtvstools/OtherToken.cs deleted file mode 100644 index 600b6590..00000000 --- a/src/qtvstools/OtherToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class OtherToken : Token - { - public OtherToken() - : base(TokenType.Other) - { - } - } -} -#endif diff --git a/src/qtvstools/PropertyToken.cs b/src/qtvstools/PropertyToken.cs deleted file mode 100644 index 9d954638..00000000 --- a/src/qtvstools/PropertyToken.cs +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Classification; - -namespace QtVsTools -{ - public class PropertyToken : Token - { - public PropertyToken() - : base(TokenType.Property) - { - } - } -} -#endif diff --git a/src/qtvstools/QtVsTools.csproj b/src/qtvstools/QtVsTools.csproj index fe3df603..d96e4b9f 100644 --- a/src/qtvstools/QtVsTools.csproj +++ b/src/qtvstools/QtVsTools.csproj @@ -51,13 +51,6 @@ <SubType>Form</SubType> </Compile> <Compile Include="ChangeFor.cs" /> - <Compile Include="Classifier.cs" /> - <Compile Include="ClassifierClassificationDefinition.cs" /> - <Compile Include="ClassifierDefinitions.cs" /> - <Compile Include="ClassifierProvider.cs" /> - <Compile Include="ClassifierTypes.cs" /> - <Compile Include="CommentToken.cs" /> - <Compile Include="ContentTypeDefinition.cs" /> <Compile Include="DefaultEditor.cs" /> <Compile Include="DefaultEditorsBase.cs" /> <Compile Include="DefaultEditorsClient.cs" /> @@ -82,13 +75,8 @@ <Compile Include="FormVSQtSettings.Designer.cs"> <DependentUpon>FormVSQtSettings.cs</DependentUpon> </Compile> - <Compile Include="JsKeywordToken.cs" /> - <Compile Include="KeywordToken.cs" /> - <Compile Include="MultilineCommentToken.cs" /> - <Compile Include="OtherToken.cs" /> <Compile Include="ProjectQtSettings.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="PropertyToken.cs" /> <Compile Include="QMakeWrapper.cs" /> <Compile Include="QML\Classification\QmlClassificationFormat.cs" /> <Compile Include="QML\Classification\QmlSyntaxClassifier.cs" /> @@ -111,12 +99,8 @@ <Compile Include="QtSolutionContextMenu.cs" /> <Compile Include="QtVsToolsDefaultEditors.cs" /> <Compile Include="SR.cs" /> - <Compile Include="StringToken.cs" /> - <Compile Include="Token.cs" /> - <Compile Include="TokenType.cs" /> <Compile Include="Translation.cs" /> <Compile Include="TranslationItem.cs" /> - <Compile Include="TypeToken.cs" /> <Compile Include="Vsix.cs" /> <Compile Include="VSQtSettings.cs" /> <Compile Include="VsToolsDialogWindow.cs" /> diff --git a/src/qtvstools/StringToken.cs b/src/qtvstools/StringToken.cs deleted file mode 100644 index bc4b0d88..00000000 --- a/src/qtvstools/StringToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class StringToken : Token - { - public StringToken() - : base(TokenType.String) - { - } - } -} -#endif diff --git a/src/qtvstools/Token.cs b/src/qtvstools/Token.cs deleted file mode 100644 index 9e678ea9..00000000 --- a/src/qtvstools/Token.cs +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public abstract class Token - { - protected Token(TokenType type) - { - Type = type; - } - - public int Length { get; set; } - public bool ContinueParsing { get; set; } - public TokenType Type { get; private set; } - } -} -#endif diff --git a/src/qtvstools/TokenType.cs b/src/qtvstools/TokenType.cs deleted file mode 100644 index 904fd7aa..00000000 --- a/src/qtvstools/TokenType.cs +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public enum TokenType - { - None = -1, - Other = 0, - Comment, - MultilineComment, - Type, - Keyword, - JsKeyword, - String, - Property - } -} -#endif diff --git a/src/qtvstools/TypeToken.cs b/src/qtvstools/TypeToken.cs deleted file mode 100644 index 14e92dad..00000000 --- a/src/qtvstools/TypeToken.cs +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt VS Tools. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if VS2013 -namespace QtVsTools -{ - public class TypeToken : Token - { - public TypeToken() - : base(TokenType.Type) - { - } - } -} -#endif diff --git a/src/qtvstools/Vsix.cs b/src/qtvstools/Vsix.cs index c3bd15a9..bb31360d 100644 --- a/src/qtvstools/Vsix.cs +++ b/src/qtvstools/Vsix.cs @@ -237,6 +237,14 @@ namespace QtVsTools } else { Directory.Delete(qttmlanguage, true); } + + //Remove textmate-based QML syntax highlighting + var qmlTextmate = Path.Combine(qttmlanguage, "qml"); + if (Directory.Exists(qmlTextmate)) { + try { + Directory.Delete(qmlTextmate, true); + } catch { } + } #endif } } |