diff --git a/extensions/emmet/package.nls.json b/extensions/emmet/package.nls.json
index d43ba09bc46..3f3bf912fd8 100644
--- a/extensions/emmet/package.nls.json
+++ b/extensions/emmet/package.nls.json
@@ -25,10 +25,10 @@
"command.decrementNumberByTen": "Decrement by 10",
"emmetSyntaxProfiles": "Define profile for specified syntax or use your own profile with specific rules.",
"emmetExclude": "An array of languages where Emmet abbreviations should not be expanded.",
- "emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.'",
- "emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option \"inMarkupAndStylesheetFilesOnly\" applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option \"always\" applies to all parts of the file regardless of markup/css.",
- "emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to \"never\".",
- "emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n E.g.: {\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}",
+ "emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.",
+ "emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option `\"inMarkupAndStylesheetFilesOnly\"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `\"always\"` applies to all parts of the file regardless of markup/css.",
+ "emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `\"never\"`.",
+ "emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n E.g.: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`",
"emmetVariables": "Variables to be used in Emmet snippets",
"emmetTriggerExpansionOnTab": "When enabled, Emmet abbreviations are expanded when pressing TAB.",
"emmetPreferences": "Preferences used to modify behavior of some actions and resolvers of Emmet.",
@@ -40,7 +40,7 @@
"emmetPreferencesCssBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations",
"emmetPreferencesSassBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files",
"emmetPreferencesStylusBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files",
- "emmetShowSuggestionsAsSnippets": "If true, then Emmet suggestions will show up as snippets allowing you to order them as per editor.snippetSuggestions setting.",
+ "emmetShowSuggestionsAsSnippets": "If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.",
"emmetPreferencesBemElementSeparator": "Element separator used for classes when using the BEM filter",
"emmetPreferencesBemModifierSeparator": "Modifier separator used for classes when using the BEM filter",
"emmetPreferencesFilterCommentBefore": "A definition of comment that should be placed before matched element when comment filter is applied.",
@@ -54,5 +54,5 @@
"emmetPreferencesCssOProperties": "Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix.",
"emmetPreferencesCssMsProperties": "Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix.",
"emmetPreferencesCssFuzzySearchMinScore": "The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",
- "emmetOptimizeStylesheetParsing": "When set to false, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to true, only the content around the current position in css/scss/less files is parsed."
+ "emmetOptimizeStylesheetParsing": "When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in css/scss/less files is parsed."
}
diff --git a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json
index 84356109cde..4b280955153 100644
--- a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json
+++ b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json
@@ -4,19 +4,19 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
- "version": "https://github.com/ionide/ionide-fsgrammar/commit/bd8d1225f93894a50bc8da6f5a76409b024d3d22",
+ "version": "https://github.com/ionide/ionide-fsgrammar/commit/67c9f45ebbbd5a12d89ffad1661caf8452f1d552",
"name": "fsharp",
"scopeName": "source.fsharp",
"patterns": [
+ {
+ "include": "#compiler_directives"
+ },
{
"include": "#comments"
},
{
"include": "#constants"
},
- {
- "include": "#structure"
- },
{
"include": "#strings"
},
@@ -30,10 +30,10 @@
"include": "#definition"
},
{
- "include": "#attributes"
+ "include": "#abstract_definition"
},
{
- "include": "#method_calls"
+ "include": "#attributes"
},
{
"include": "#modules"
@@ -44,6 +44,9 @@
{
"include": "#du_declaration"
},
+ {
+ "include": "#record_declaration"
+ },
{
"include": "#keywords"
},
@@ -58,6 +61,96 @@
}
],
"repository": {
+ "generic_declaration": {
+ "patterns": [
+ {
+ "match": "([^<>,])",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "begin": "(<)",
+ "end": "(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "match": "([^<>,])",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "include": "#generic_declaration"
+ }
+ ]
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
+ },
+ "record_signature": {
+ "patterns": [
+ {
+ "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "variable.parameter.fsharp"
+ }
+ }
+ },
+ {
+ "begin": "({)",
+ "end": "(})",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "variable.parameter.fsharp"
+ }
+ }
+ },
+ {
+ "include": "#record_signature"
+ }
+ ]
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
+ },
"anonymous_functions": {
"patterns": [
{
@@ -66,15 +159,32 @@
"end": "(->)",
"beginCaptures": {
"1": {
- "name": "keyword.other.function-definition.fsharp"
+ "name": "keyword.fsharp"
}
},
"endCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
}
},
"patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#member_declaration"
+ },
+ {
+ "match": "(:)(\\s*([?[:alpha:]0-9'`<>^._ ]+))*",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
{
"include": "#variables"
}
@@ -87,7 +197,7 @@
{
"name": "support.function.attribute.fsharp",
"begin": "\\[\\<",
- "end": "\\>\\]",
+ "end": "\\>\\]|\\]",
"patterns": [
{
"include": "$self"
@@ -178,57 +288,189 @@
}
]
},
+ "abstract_definition": {
+ "name": "abstract.definition.fsharp",
+ "begin": "\\b(abstract)\\s+(member)?(\\s+\\[\\<.*\\>\\])?\\s*([_[:alpha:]0-9,\\._`\\s]+)(:)",
+ "end": "\\s*(with)\\b|=|$",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.fsharp"
+ },
+ "2": {
+ "name": "keyword.fsharp"
+ },
+ "3": {
+ "name": "support.function.attribute.fsharp"
+ },
+ "5": {
+ "name": "keyword.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#common_declaration"
+ },
+ {
+ "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)){0,1}",
+ "captures": {
+ "1": {
+ "name": "variable.parameter.fsharp"
+ },
+ "2": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "3": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "match": "(?!with|get|set\\b)\\b([\\w0-9'`^._]+)",
+ "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
+ },
"definition": {
"patterns": [
{
"name": "binding.fsharp",
- "begin": "\\b(val mutable|val|let mutable|let inline|let|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]|(?<=,)\\s)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]|(?<=,)\\s)*)?",
- "end": "((``.*``)|(with)\\b|=|$)",
+ "begin": "\\b(val mutable|val|let mutable|let inline|let|member val|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?",
+ "end": "\\s*(with\\b|=|\\n+=)",
"beginCaptures": {
"1": {
- "name": "keyword.other.binding.fsharp"
+ "name": "keyword.fsharp"
},
"2": {
- "name": "keyword.other.function-recursive.fsharp"
+ "name": "keyword.fsharp"
},
"3": {
"name": "support.function.attribute.fsharp"
},
"4": {
- "name": "keyword.other.access.fsharp"
+ "name": "keyword.fsharp"
},
"5": {
- "name": "variable.other.binding.fsharp"
+ "name": "variable.fsharp"
}
},
"endCaptures": {
"1": {
- "name": "keyword.other.fsharp"
- },
- "2": {
- "name": "variable.other.binding.fsharp"
- },
- "3": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
}
},
"patterns": [
{
- "include": "#variables"
+ "include": "#comments"
},
{
- "include": "#member_declaration"
- },
- {
- "match": "(:)(\\s*([?[:alpha:]0-9'<>^._ ]+))*",
+ "match": "(:)\\s*(\\()?\\s*(([?[:alpha:]0-9'`^._ ]+))*",
"captures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "3": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "match": "(\\*\\s*\\()\\s*(([?[:alpha:]0-9'`^._ ]+))*",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
},
"2": {
"name": "entity.name.type.fsharp"
}
}
+ },
+ {
+ "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "3": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "match": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "begin": "(<)",
+ "end": "(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#generic_declaration"
+ }
+ ]
+ },
+ {
+ "begin": "({)",
+ "end": "(})",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#record_signature"
+ }
+ ]
+ },
+ {
+ "include": "#variables"
+ },
+ {
+ "include": "#keywords"
}
]
}
@@ -242,23 +484,26 @@
"end": "$|(\\|)",
"beginCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
}
},
"endCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.symbol.fsharp"
}
},
"patterns": [
{
- "match": "([[:alpha:]0-9'`<>^._]+)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+)",
+ "include": "#comments"
+ },
+ {
+ "match": "([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)",
"captures": {
"1": {
"name": "variable.parameter.fsharp"
},
"2": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.symbol.fsharp"
},
"3": {
"name": "entity.name.type.fsharp"
@@ -266,17 +511,7 @@
}
},
{
- "match": "([[:alpha:]0-9'`<>^._]+)",
- "captures": {
- "1": {
- "name": "entity.name.type.fsharp"
- }
- }
- },
- {
- "begin": "\\(",
- "end": "\\)",
- "match": "([[:alpha:]0-9'`<>^._]+)",
+ "match": "([[:alpha:]0-9'`^._]+)|``([[:alpha:]0-9'^._ ]+)``",
"captures": {
"1": {
"name": "entity.name.type.fsharp"
@@ -293,17 +528,12 @@
"keywords": {
"patterns": [
{
- "name": "keyword.other.fsharp",
+ "name": "keyword.fsharp",
"match": "\\b(private|to|public|internal|function|yield!|yield|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|abstract|property|union|enum|member|try|finally|and|when|use|use\\!|struct|while|mutable)(?!')\\b"
},
{
- "name": "meta.preprocessor.fsharp",
- "begin": "^\\s*#\\s*(light)\\b",
- "end": "(\\s|$)"
- },
- {
- "name": "keyword.other.fsharp",
- "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|<<<|>>>|\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\<\\<)"
+ "name": "keyword.symbol.fsharp",
+ "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|<<<|>>>|\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\,|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\(|\\)|\\<\\<)"
}
]
},
@@ -312,18 +542,23 @@
{
"name": "entity.name.section.fsharp",
"begin": "\\b(namespace|module)\\s*(public|internal|private)?\\s+([[:alpha:]][[:alpha:]0-9'_. ]*)",
- "end": "(\\s|$)",
+ "end": "(\\s?=|\\s|$)",
"beginCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"2": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"3": {
"name": "entity.name.section.fsharp"
}
},
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
"patterns": [
{
"name": "entity.name.section.fsharp",
@@ -345,7 +580,7 @@
"end": "(\\s|$)",
"beginCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"2": {
"name": "entity.name.section.fsharp"
@@ -372,7 +607,7 @@
"end": "(\\s|$)",
"beginCaptures": {
"1": {
- "name": "keyword.other.namespace-definition.fsharp"
+ "name": "keyword.fsharp"
},
"2": {
"name": "entity.name.type.namespace.fsharp"
@@ -485,7 +720,7 @@
"match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o)|(s|b|O)|(\\+?A)))",
"captures": {
"1": {
- "name": "keyword.other.format.specifier.fsharp"
+ "name": "keyword.format.specifier.fsharp"
}
}
}
@@ -499,29 +734,132 @@
},
{
"name": "variable.parameter.fsharp",
- "match": "[[:alpha:]'_]\\w*"
+ "match": "[[:alpha:]0-9'`<>^._ ]\\w*"
+ }
+ ]
+ },
+ "common_declaration": {
+ "patterns": [
+ {
+ "begin": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)(<)",
+ "end": "(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "entity.name.type.fsharp"
+ },
+ "3": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "match": "([[:alpha:]0-9'`^._ ]+)",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
+ },
+ {
+ "match": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "begin": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))",
+ "end": "(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "variable.parameter.fsharp"
+ },
+ "2": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "3": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "4": {
+ "name": "entity.name.type.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "match": "([[:alpha:]0-9'`^._ ]+)",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
}
]
},
"member_declaration": {
"patterns": [
{
- "begin": "\\(",
- "end": "\\)",
+ "begin": "(\\()",
+ "end": "(\\))",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
"patterns": [
{
- "match": "\\?{0,1}([[:alpha:]0-9'`<>^._]+)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'<>^._ ]+)){0,1}",
+ "include": "#comments"
+ },
+ {
+ "include": "#common_declaration"
+ },
+ {
+ "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>^._ ]+)){0,1}",
"captures": {
"1": {
"name": "variable.parameter.fsharp"
},
"2": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.symbol.fsharp"
},
"3": {
"name": "entity.name.type.fsharp"
}
}
+ },
+ {
+ "include": "#keywords"
}
]
}
@@ -550,45 +888,210 @@
"patterns": [
{
"name": "record.fsharp",
- "begin": "(type)[\\s]+(private|internal|public)?[\\s]*([[:alpha:]0-9'<>^:,._]+)[\\s]?(private|internal|public)?[\\s]*",
- "end": "[\\s]*((with)|((as) ([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))",
+ "begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)",
+ "end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))",
"beginCaptures": {
"1": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"2": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"3": {
- "name": "entity.name.type.fsharp"
+ "name": "support.function.attribute.fsharp"
},
"4": {
- "name": "keyword.other.fsharp"
+ "name": "entity.name.type.fsharp"
+ },
+ "5": {
+ "name": "keyword.symbol.fsharp"
}
},
"endCaptures": {
"2": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"3": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"4": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.fsharp"
},
"5": {
"name": "variable.parameter.fsharp"
},
"6": {
- "name": "keyword.other.fsharp"
+ "name": "keyword.symbol.fsharp"
},
"7": {
"name": "constant.language.unit.fsharp"
}
},
"patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "match": "\\s*(>)\\s*(private|internal|public)?",
+ "captures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "2": {
+ "name": "keyword.fsharp"
+ }
+ }
+ },
+ {
+ "match": "([[:alpha:]0-9'`^._ ]+)",
+ "captures": {
+ "1": {
+ "name": "entity.name.type.fsharp"
+ }
+ }
+ },
{
"include": "#member_declaration"
+ },
+ {
+ "include": "#keywords"
+ }
+ ]
+ },
+ {
+ "name": "record.fsharp",
+ "begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+<(.*)>|[[:alpha:]0-9'^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)[\\s]?(private|internal|public)?[\\s]*",
+ "end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.fsharp"
+ },
+ "2": {
+ "name": "keyword.fsharp"
+ },
+ "3": {
+ "name": "support.function.attribute.fsharp"
+ },
+ "4": {
+ "name": "entity.name.type.fsharp"
+ },
+ "6": {
+ "name": "keyword.fsharp"
+ }
+ },
+ "endCaptures": {
+ "2": {
+ "name": "keyword.fsharp"
+ },
+ "3": {
+ "name": "keyword.fsharp"
+ },
+ "4": {
+ "name": "keyword.fsharp"
+ },
+ "5": {
+ "name": "variable.parameter.fsharp"
+ },
+ "6": {
+ "name": "keyword.symbol.fsharp"
+ },
+ "7": {
+ "name": "constant.language.unit.fsharp"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "include": "#member_declaration"
+ }
+ ]
+ }
+ ]
+ },
+ "record_declaration": {
+ "patterns": [
+ {
+ "begin": "(\\{)",
+ "beginCaptures": {
+ "1": {
+ "name": "keyword.symbol.fsharp"
+ }
+ },
+ "end": "(?<=\\})",
+ "patterns": [
+ {
+ "include": "#comments"
+ },
+ {
+ "begin": "(((mutable)\\s[[:alpha:]]+)|[[:alpha:]0-9'`<>^._]*)\\s*((?=",
- "t": "source.fsharp keyword.other.fsharp",
+ "t": "source.fsharp keyword.symbol.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -925,7 +1046,7 @@
},
{
"c": "override",
- "t": "source.fsharp binding.fsharp keyword.other.binding.fsharp",
+ "t": "source.fsharp binding.fsharp keyword.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -947,7 +1068,7 @@
},
{
"c": "this.ToString",
- "t": "source.fsharp binding.fsharp variable.other.binding.fsharp",
+ "t": "source.fsharp binding.fsharp variable.fsharp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
@@ -958,13 +1079,13 @@
},
{
"c": " ",
- "t": "source.fsharp binding.fsharp",
+ "t": "source.fsharp binding.fsharp variable.parameter.fsharp",
"r": {
- "dark_plus": "default: #D4D4D4",
- "light_plus": "default: #000000",
+ "dark_plus": "variable: #9CDCFE",
+ "light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
- "hc_black": "default: #FFFFFF"
+ "hc_black": "variable: #9CDCFE"
}
},
{
@@ -991,7 +1112,7 @@
},
{
"c": "=",
- "t": "source.fsharp binding.fsharp keyword.other.fsharp",
+ "t": "source.fsharp binding.fsharp keyword.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -1057,7 +1178,7 @@
},
{
"c": "+",
- "t": "source.fsharp keyword.other.fsharp",
+ "t": "source.fsharp keyword.symbol.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -1079,7 +1200,7 @@
},
{
"c": "+",
- "t": "source.fsharp keyword.other.fsharp",
+ "t": "source.fsharp keyword.symbol.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -1145,7 +1266,7 @@
},
{
"c": "+",
- "t": "source.fsharp keyword.other.fsharp",
+ "t": "source.fsharp keyword.symbol.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -1211,7 +1332,7 @@
},
{
"c": "+",
- "t": "source.fsharp keyword.other.fsharp",
+ "t": "source.fsharp keyword.symbol.fsharp",
"r": {
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
@@ -1221,7 +1342,51 @@
}
},
{
- "c": " (string)internalAge",
+ "c": " ",
+ "t": "source.fsharp",
+ "r": {
+ "dark_plus": "default: #D4D4D4",
+ "light_plus": "default: #000000",
+ "dark_vs": "default: #D4D4D4",
+ "light_vs": "default: #000000",
+ "hc_black": "default: #FFFFFF"
+ }
+ },
+ {
+ "c": "(",
+ "t": "source.fsharp keyword.symbol.fsharp",
+ "r": {
+ "dark_plus": "keyword: #569CD6",
+ "light_plus": "keyword: #0000FF",
+ "dark_vs": "keyword: #569CD6",
+ "light_vs": "keyword: #0000FF",
+ "hc_black": "keyword: #569CD6"
+ }
+ },
+ {
+ "c": "string",
+ "t": "source.fsharp",
+ "r": {
+ "dark_plus": "default: #D4D4D4",
+ "light_plus": "default: #000000",
+ "dark_vs": "default: #D4D4D4",
+ "light_vs": "default: #000000",
+ "hc_black": "default: #FFFFFF"
+ }
+ },
+ {
+ "c": ")",
+ "t": "source.fsharp keyword.symbol.fsharp",
+ "r": {
+ "dark_plus": "keyword: #569CD6",
+ "light_plus": "keyword: #0000FF",
+ "dark_vs": "keyword: #569CD6",
+ "light_vs": "keyword: #0000FF",
+ "hc_black": "keyword: #569CD6"
+ }
+ },
+ {
+ "c": "internalAge",
"t": "source.fsharp",
"r": {
"dark_plus": "default: #D4D4D4",
diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json
index 7dc623f9c8e..7b56fd9e95a 100644
--- a/extensions/git/package.nls.json
+++ b/extensions/git/package.nls.json
@@ -51,7 +51,7 @@
"command.stashPop": "Pop Stash...",
"command.stashPopLatest": "Pop Latest Stash",
"config.enabled": "Whether git is enabled",
- "config.path": "Path to the git executable",
+ "config.path": "Path to the git executable.",
"config.autoRepositoryDetection": "Configures when repositories should be automatically detected.",
"config.autorefresh": "Whether auto refreshing is enabled",
"config.autofetch": "Whether auto fetching is enabled",
diff --git a/extensions/git/syntaxes/git-rebase.tmLanguage.json b/extensions/git/syntaxes/git-rebase.tmLanguage.json
index 3ee481bede1..a2c116bd09b 100644
--- a/extensions/git/syntaxes/git-rebase.tmLanguage.json
+++ b/extensions/git/syntaxes/git-rebase.tmLanguage.json
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
- "version": "https://github.com/textmate/git.tmbundle/commit/d1db42c2d71948662098183a6df519fb53a7a15b",
+ "version": "https://github.com/textmate/git.tmbundle/commit/3f6ad2138200db14b57a090ecb2d2e733275ca3e",
"name": "Git Rebase Message",
"scopeName": "text.git-rebase",
"patterns": [
@@ -29,7 +29,23 @@
"name": "meta.commit-message.git-rebase"
}
},
- "match": "^\\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|exec|x|drop|d)\\s+([0-9a-f]+)\\s+(.*)$",
+ "match": "^\\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|drop|d)\\s+([0-9a-f]+)\\s+(.*)$",
+ "name": "meta.commit-command.git-rebase"
+ },
+ {
+ "captures": {
+ "1": {
+ "name": "support.function.git-rebase"
+ },
+ "2": {
+ "patterns": [
+ {
+ "include": "source.shell"
+ }
+ ]
+ }
+ },
+ "match": "^\\s*(exec|x)\\s+(.*)$",
"name": "meta.commit-command.git-rebase"
}
]
diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json
index 73c94b4acf6..077075780c3 100644
--- a/extensions/html-language-features/package.nls.json
+++ b/extensions/html-language-features/package.nls.json
@@ -1,12 +1,12 @@
{
"displayName": "HTML Language Features",
"description": "Provides rich language support for HTML, Razor, and Handlebar files",
- "html.format.enable.desc": "Enable/disable default HTML formatter",
+ "html.format.enable.desc": "Enable/disable default HTML formatter.",
"html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).",
"html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.",
"html.format.contentUnformatted.desc": "List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' tag.",
"html.format.indentInnerHtml.desc": "Indent
and sections.",
- "html.format.preserveNewLines.desc": "Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.",
+ "html.format.preserveNewLines.desc": "Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.",
"html.format.maxPreserveNewLines.desc": "Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited.",
"html.format.indentHandlebars.desc": "Format and indent {{#foo}} and {{/foo}}.",
"html.format.endWithNewline.desc": "End with a newline.",
@@ -16,11 +16,11 @@
"html.format.wrapAttributes.force": "Wrap each attribute except first.",
"html.format.wrapAttributes.forcealign": "Wrap each attribute except first and keep aligned.",
"html.format.wrapAttributes.forcemultiline": "Wrap each attribute.",
- "html.suggest.angular1.desc": "Configures if the built-in HTML language support suggests Angular V1 tags and properties.",
- "html.suggest.ionic.desc": "Configures if the built-in HTML language support suggests Ionic tags, properties and values.",
- "html.suggest.html5.desc":"Configures if the built-in HTML language support suggests HTML5 tags, properties and values.",
+ "html.suggest.angular1.desc": "Controls whether the built-in HTML language support suggests Angular V1 tags and properties.",
+ "html.suggest.ionic.desc": "Controls whether the built-in HTML language support suggests Ionic tags, properties and values.",
+ "html.suggest.html5.desc": "Controls whether the built-in HTML language support suggests HTML5 tags, properties and values.",
"html.trace.server.desc": "Traces the communication between VS Code and the HTML language server.",
- "html.validate.scripts": "Configures if the built-in HTML language support validates embedded scripts.",
- "html.validate.styles": "Configures if the built-in HTML language support validates embedded styles.",
+ "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.",
+ "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.",
"html.autoClosingTags": "Enable/disable autoclosing of HTML tags."
}
\ No newline at end of file
diff --git a/extensions/java/syntaxes/java.tmLanguage.json b/extensions/java/syntaxes/java.tmLanguage.json
index b629f66dc70..b19cc7b4754 100644
--- a/extensions/java/syntaxes/java.tmLanguage.json
+++ b/extensions/java/syntaxes/java.tmLanguage.json
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
- "version": "https://github.com/atom/language-java/commit/b9f1a853a69184363b0fb15f52da07c9660bf730",
+ "version": "https://github.com/atom/language-java/commit/2f20bc5a5b07686ec0139e2969431210d81b6991",
"name": "Java",
"scopeName": "source.java",
"patterns": [
@@ -1424,7 +1424,7 @@
},
"variables": {
"begin": "(?x)\n(?=\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap`, or `List`\n )?\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|;)\n)",
- "end": "(?=;)",
+ "end": "(?=\\=|;)",
"name": "meta.definition.variable.java",
"patterns": [
{
@@ -1438,20 +1438,6 @@
{
"include": "#all-types"
},
- {
- "begin": "=",
- "beginCaptures": {
- "0": {
- "name": "keyword.operator.assignment.java"
- }
- },
- "end": "(?=;)",
- "patterns": [
- {
- "include": "#code"
- }
- ]
- },
{
"include": "#code"
}
@@ -1459,7 +1445,7 @@
},
"member-variables": {
"begin": "(?=private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final)",
- "end": "(?=;)",
+ "end": "(?=\\=|;)",
"patterns": [
{
"include": "#storage-modifiers"
diff --git a/extensions/java/test/colorize-results/basic_java.json b/extensions/java/test/colorize-results/basic_java.json
index 1ef3a8ff324..665268f9e6a 100644
--- a/extensions/java/test/colorize-results/basic_java.json
+++ b/extensions/java/test/colorize-results/basic_java.json
@@ -727,7 +727,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -738,7 +738,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -749,7 +749,7 @@
},
{
"c": "0.0",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
@@ -826,7 +826,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -837,7 +837,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -848,7 +848,7 @@
},
{
"c": "10e3",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
@@ -925,7 +925,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -936,7 +936,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -947,7 +947,7 @@
},
{
"c": "134l",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
@@ -1398,7 +1398,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -1409,7 +1409,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -1420,7 +1420,7 @@
},
{
"c": "0",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
@@ -2047,7 +2047,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -2058,7 +2058,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -2069,7 +2069,7 @@
},
{
"c": "0x5",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.hex.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.hex.java",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
@@ -2179,7 +2179,7 @@
},
{
"c": "=",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
@@ -2190,7 +2190,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -2201,7 +2201,7 @@
},
{
"c": "new",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.control.new.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.control.new.java",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
@@ -2212,7 +2212,7 @@
},
{
"c": " ",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -2223,7 +2223,7 @@
},
{
"c": "Vector",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java entity.name.function.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java entity.name.function.java",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
@@ -2234,7 +2234,7 @@
},
{
"c": "(",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java punctuation.definition.parameters.begin.bracket.round.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java punctuation.definition.parameters.begin.bracket.round.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@@ -2245,7 +2245,7 @@
},
{
"c": ")",
- "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java punctuation.definition.parameters.end.bracket.round.java",
+ "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java punctuation.definition.parameters.end.bracket.round.java",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
diff --git a/extensions/lua/syntaxes/lua.tmLanguage.json b/extensions/lua/syntaxes/lua.tmLanguage.json
index 8adc657f806..c2b31570531 100644
--- a/extensions/lua/syntaxes/lua.tmLanguage.json
+++ b/extensions/lua/syntaxes/lua.tmLanguage.json
@@ -4,23 +4,25 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
- "version": "https://github.com/textmate/lua.tmbundle/commit/42da2c6ff5d86c068f72520f856190f413911a80",
+ "version": "https://github.com/textmate/lua.tmbundle/commit/8ae5641365b28f697121ba1133890e8d81f5b00e",
"name": "Lua",
"scopeName": "source.lua",
- "comment": "Lua Syntax: version 0.8",
"patterns": [
{
- "begin": "\\b((local\\b)\\s+)?(function)\\s*(\\s+[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)*(:[a-zA-Z_][a-zA-Z0-9_]*)?\\s*)?(\\()",
+ "begin": "\\b(?:(local)\\s+)?(function)\\s*(?:\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:([\\.:])[a-zA-Z_][a-zA-Z0-9_]*)?)\\s*)?(\\()",
"beginCaptures": {
"1": {
"name": "storage.modifier.local.lua"
},
- "3": {
+ "2": {
"name": "keyword.control.lua"
},
- "4": {
+ "3": {
"name": "entity.name.function.lua"
},
+ "4": {
+ "name": "punctuation.separator.parameter.lua"
+ },
"5": {
"name": "punctuation.definition.parameters.begin.lua"
}
@@ -36,6 +38,10 @@
{
"match": "[a-zA-Z_][a-zA-Z0-9_]*",
"name": "variable.parameter.function.lua"
+ },
+ {
+ "match": ",",
+ "name": "punctuation.separator.arguments.lua"
}
]
},
diff --git a/extensions/lua/test/colorize-results/test_lua.json b/extensions/lua/test/colorize-results/test_lua.json
index bc041f3ac30..c1495f2253e 100644
--- a/extensions/lua/test/colorize-results/test_lua.json
+++ b/extensions/lua/test/colorize-results/test_lua.json
@@ -55,7 +55,18 @@
}
},
{
- "c": " fact ",
+ "c": " ",
+ "t": "source.lua meta.function.lua",
+ "r": {
+ "dark_plus": "default: #D4D4D4",
+ "light_plus": "default: #000000",
+ "dark_vs": "default: #D4D4D4",
+ "light_vs": "default: #000000",
+ "hc_black": "default: #FFFFFF"
+ }
+ },
+ {
+ "c": "fact",
"t": "source.lua meta.function.lua entity.name.function.lua",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
@@ -66,7 +77,7 @@
}
},
{
- "c": "(",
+ "c": " ",
"t": "source.lua meta.function.lua",
"r": {
"dark_plus": "default: #D4D4D4",
@@ -76,6 +87,17 @@
"hc_black": "default: #FFFFFF"
}
},
+ {
+ "c": "(",
+ "t": "source.lua meta.function.lua punctuation.definition.parameters.begin.lua",
+ "r": {
+ "dark_plus": "default: #D4D4D4",
+ "light_plus": "default: #000000",
+ "dark_vs": "default: #D4D4D4",
+ "light_vs": "default: #000000",
+ "hc_black": "default: #FFFFFF"
+ }
+ },
{
"c": "n",
"t": "source.lua meta.function.lua variable.parameter.function.lua",
diff --git a/extensions/markdown-language-features/src/extension.ts b/extensions/markdown-language-features/src/extension.ts
index a9d95e36ce8..7786db20216 100644
--- a/extensions/markdown-language-features/src/extension.ts
+++ b/extensions/markdown-language-features/src/extension.ts
@@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) {
const telemetryReporter = loadDefaultTelemetryReporter();
context.subscriptions.push(telemetryReporter);
- const contributions = getMarkdownExtensionContributions();
+ const contributions = getMarkdownExtensionContributions(context);
const cspArbiter = new ExtensionContentSecurityPolicyArbiter(context.globalState, context.workspaceState);
const engine = new MarkdownEngine(contributions, githubSlugifier);
diff --git a/extensions/markdown-language-features/src/features/preview.ts b/extensions/markdown-language-features/src/features/preview.ts
index 2f4993fa13a..f15efe24098 100644
--- a/extensions/markdown-language-features/src/features/preview.ts
+++ b/extensions/markdown-language-features/src/features/preview.ts
@@ -271,6 +271,14 @@ export class MarkdownPreview {
this.editor.title = MarkdownPreview.getPreviewTitle(this._resource, this._locked);
}
+ private get iconPath() {
+ const root = path.join(this._contributions.extensionPath, 'media');
+ return {
+ light: vscode.Uri.file(path.join(root, 'Preview.svg')),
+ dark: vscode.Uri.file(path.join(root, 'Preview_inverse.svg'))
+ };
+ }
+
private isPreviewOf(resource: vscode.Uri): boolean {
return this._resource.fsPath === resource.fsPath;
}
@@ -327,6 +335,7 @@ export class MarkdownPreview {
const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line, this.state);
if (this._resource === resource) {
this.editor.title = MarkdownPreview.getPreviewTitle(this._resource, this._locked);
+ this.editor.iconPath = this.iconPath;
this.editor.webview.options = MarkdownPreview.getWebviewOptions(resource, this._contributions);
this.editor.webview.html = content;
}
diff --git a/extensions/markdown-language-features/src/markdownExtensions.ts b/extensions/markdown-language-features/src/markdownExtensions.ts
index a9ef207cf38..55c8d76e7a4 100644
--- a/extensions/markdown-language-features/src/markdownExtensions.ts
+++ b/extensions/markdown-language-features/src/markdownExtensions.ts
@@ -26,6 +26,7 @@ const resolveExtensionResources = (extension: vscode.Extension, resourcePat
};
export interface MarkdownContributions {
+ readonly extensionPath: string;
readonly previewScripts: vscode.Uri[];
readonly previewStyles: vscode.Uri[];
readonly markdownItPlugins: Thenable<(md: any) => any>[];
@@ -40,6 +41,10 @@ class MarkdownExtensionContributions implements MarkdownContributions {
private _loaded = false;
+ public constructor(
+ public readonly extensionPath: string,
+ ) { }
+
public get previewScripts(): vscode.Uri[] {
this.ensureLoaded();
return this._scripts;
@@ -111,6 +116,6 @@ class MarkdownExtensionContributions implements MarkdownContributions {
}
}
-export function getMarkdownExtensionContributions(): MarkdownContributions {
- return new MarkdownExtensionContributions();
+export function getMarkdownExtensionContributions(context: vscode.ExtensionContext): MarkdownContributions {
+ return new MarkdownExtensionContributions(context.extensionPath);
}
\ No newline at end of file
diff --git a/extensions/markdown-language-features/src/test/engine.ts b/extensions/markdown-language-features/src/test/engine.ts
index 860bafad7cc..a1834e057a2 100644
--- a/extensions/markdown-language-features/src/test/engine.ts
+++ b/extensions/markdown-language-features/src/test/engine.ts
@@ -9,6 +9,7 @@ import { MarkdownContributions } from '../markdownExtensions';
import { githubSlugifier } from '../slugify';
const emptyContributions = new class implements MarkdownContributions {
+ readonly extensionPath = '';
readonly previewScripts: vscode.Uri[] = [];
readonly previewStyles: vscode.Uri[] = [];
readonly previewResourceRoots: vscode.Uri[] = [];
diff --git a/extensions/npm/.vscode/tasks.json b/extensions/npm/.vscode/tasks.json
index 0a411c1c867..b7c8a281635 100644
--- a/extensions/npm/.vscode/tasks.json
+++ b/extensions/npm/.vscode/tasks.json
@@ -1,8 +1,10 @@
{
- "version": "0.1.0",
+ "version": "2.0.0",
"command": "npm",
- "isShellCommand": true,
- "showOutput": "silent",
+ "type": "shell",
+ "presentation": {
+ "reveal": "silent",
+ },
"args": ["run", "compile"],
"isBackground": true,
"problemMatcher": "$tsc-watch"
diff --git a/extensions/npm/README.md b/extensions/npm/README.md
index c3dd9437203..6c8fa19625d 100644
--- a/extensions/npm/README.md
+++ b/extensions/npm/README.md
@@ -29,5 +29,5 @@ The extension provides code lense actions to run or debug a script from the edit
- `npm.exclude` - Glob patterns for folders that should be excluded from automatic script detection. The pattern is matched against the **absolute path** of the package.json. For example, to exclude all test folders use '**/test/**'.
- `npm.enableScriptExplorer` - Enable an explorer view for npm scripts.
- `npm.scriptExplorerAction` - The default click action: `open` or `run`, the default is `open`.
-- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script.
+- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script, the default is `false`.
diff --git a/extensions/npm/package.json b/extensions/npm/package.json
index 7f4b794ee0c..434f7ea20b1 100644
--- a/extensions/npm/package.json
+++ b/extensions/npm/package.json
@@ -180,7 +180,7 @@
},
"npm.scriptCodeLens.enable": {
"type": "boolean",
- "default": true,
+ "default": false,
"scope": "resource",
"description": "%config.scriptCodeLens.enable%"
},
diff --git a/extensions/package.json b/extensions/package.json
index 7b4fd5a5bd0..1c3a19a4f02 100644
--- a/extensions/package.json
+++ b/extensions/package.json
@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
- "typescript": "3.0.1-insiders.20180713"
+ "typescript": "3.0.1-insiders.20180723"
},
"scripts": {
"postinstall": "node ./postinstall"
diff --git a/extensions/python/syntaxes/MagicPython.tmLanguage.json b/extensions/python/syntaxes/MagicPython.tmLanguage.json
index 44a995bc046..fc32d74cec5 100644
--- a/extensions/python/syntaxes/MagicPython.tmLanguage.json
+++ b/extensions/python/syntaxes/MagicPython.tmLanguage.json
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
- "version": "https://github.com/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5",
+ "version": "https://github.com/MagicStack/MagicPython/commit/fb56c6a98d684e30bed1b0f9647e85741a48f914",
"name": "MagicPython",
"scopeName": "source.python",
"patterns": [
@@ -97,7 +97,8 @@
},
"docstring-statement": {
"begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
- "end": "(?<=\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\")",
+ "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring",
+ "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
"patterns": [
{
"include": "#docstring"
@@ -164,7 +165,7 @@
{
"name": "string.quoted.docstring.single.python",
"begin": "(\\'|\\\")",
- "end": "(\\1)|((?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n",
+ "name": "meta.format.brace.python",
+ "match": "(?x)\n (\n {{ | }}\n | (?:\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n",
"captures": {
- "2": {
- "name": "storage.type.format.python"
+ "1": {
+ "name": "constant.character.format.placeholder.other.python"
},
"3": {
"name": "storage.type.format.python"
+ },
+ "4": {
+ "name": "storage.type.format.python"
}
}
},
{
- "name": "constant.character.format.placeholder.other.python",
- "begin": "(?x)\n \\{\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (?=[^'\"}\\n]*\\})\n",
- "end": "\\}",
- "beginCaptures": {
- "2": {
- "name": "storage.type.format.python"
+ "name": "meta.format.brace.python",
+ "match": "(?x)\n (\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (\n [^'\"{}\\n]+?\n |\n \\{ [^'\"}\\n]*? \\}\n )*\n }\n )\n",
+ "captures": {
+ "1": {
+ "name": "constant.character.format.placeholder.other.python"
},
"3": {
"name": "storage.type.format.python"
+ },
+ "4": {
+ "name": "storage.type.format.python"
}
- },
- "patterns": [
- {
- "match": "(?x) \\{ [^'\"}\\n]*? \\} (?=.*?\\})\n"
- }
- ]
+ }
}
]
},
@@ -4537,7 +4543,7 @@
},
"string-quoted-single-line": {
"name": "string.quoted.single.python",
- "begin": "(\\b[rR](?=[uU]))?([uU])?((['\"]))",
+ "begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))",
"end": "(\\3)|((?",
+ "name": "comment.block.xml"
+ }
+ },
+ {
+ "begin": "",
+ "name": "comment.block.xml",
+ "patterns": [
+ {
+ "begin": "--(?!>)",
+ "captures": {
+ "0": {
+ "name": "invalid.illegal.bad-comments-or-CDATA.xml"
+ }
+ }
+ }
+ ]
}
- },
- "end": "--%?>",
- "name": "comment.block.xml"
+ ]
}
}
}
\ No newline at end of file
diff --git a/extensions/yarn.lock b/extensions/yarn.lock
index 6ed3a9d31c4..1d5962931ac 100644
--- a/extensions/yarn.lock
+++ b/extensions/yarn.lock
@@ -2,6 +2,6 @@
# yarn lockfile v1
-typescript@3.0.1-insiders.20180713:
- version "3.0.1-insiders.20180713"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1-insiders.20180713.tgz#02775b5197ab02b79ed5b84e7483c18ed164e55e"
+typescript@3.0.1-insiders.20180723:
+ version "3.0.1-insiders.20180723"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1-insiders.20180723.tgz#266fbafb349a6429777ab3525cda3bb0a2adc661"
diff --git a/package.json b/package.json
index a0af247bb1f..6968445d439 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.26.0",
- "distro": "ba277984505f7010dbff765d57412a25891b4dea",
+ "distro": "4b5c6aa6ea6f222d62d08ca5653049b200be93a5",
"author": {
"name": "Microsoft Corporation"
},
@@ -50,7 +50,8 @@
"vscode-nsfw": "1.0.17",
"vscode-ripgrep": "^1.0.1",
"vscode-textmate": "^4.0.1",
- "vscode-xterm": "3.6.0-beta3",
+ "vscode-uri": "1.0.5",
+ "vscode-xterm": "3.6.0-beta5",
"yauzl": "^2.9.1"
},
"devDependencies": {
@@ -138,4 +139,4 @@
"windows-mutex": "^0.2.0",
"windows-process-tree": "0.2.2"
}
-}
\ No newline at end of file
+}
diff --git a/src/typings/vscode-xterm.d.ts b/src/typings/vscode-xterm.d.ts
index eb8c87e277a..b3a6c367c60 100644
--- a/src/typings/vscode-xterm.d.ts
+++ b/src/typings/vscode-xterm.d.ts
@@ -680,6 +680,8 @@ declare module 'vscode-xterm' {
// Modifications to official .d.ts below
declare module 'vscode-xterm' {
interface TerminalCore {
+ debug: boolean;
+
buffer: {
y: number;
ybase: number;
diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts
index 17b36ec3dea..1691821da48 100644
--- a/src/vs/base/browser/ui/inputbox/inputBox.ts
+++ b/src/vs/base/browser/ui/inputbox/inputBox.ts
@@ -535,6 +535,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge
if (next) {
this.value = next;
+ aria.status(this.value);
}
}
@@ -550,6 +551,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge
if (previous) {
this.value = previous;
+ aria.status(this.value);
}
}
diff --git a/src/vs/base/parts/ipc/common/ipc.ts b/src/vs/base/parts/ipc/common/ipc.ts
index 37555c26b07..67376daaf3d 100644
--- a/src/vs/base/parts/ipc/common/ipc.ts
+++ b/src/vs/base/parts/ipc/common/ipc.ts
@@ -260,7 +260,8 @@ export class ChannelClient implements IChannelClient, IDisposable {
let uninitializedPromise: TPromise | null = null;
const emitter = new Emitter({
onFirstListenerAdd: () => {
- uninitializedPromise = this.whenInitialized().then(() => {
+ uninitializedPromise = this.whenInitialized();
+ uninitializedPromise.then(() => {
uninitializedPromise = null;
this.send(request.raw);
});
diff --git a/src/vs/base/parts/ipc/node/ipc.cp.ts b/src/vs/base/parts/ipc/node/ipc.cp.ts
index 38a8a96f813..3d863aa9e0b 100644
--- a/src/vs/base/parts/ipc/node/ipc.cp.ts
+++ b/src/vs/base/parts/ipc/node/ipc.cp.ts
@@ -150,6 +150,7 @@ export class Client implements IChannelClient, IDisposable {
}
this.activeRequests.splice(this.activeRequests.indexOf(listener), 1);
+ listener.dispose();
if (this.activeRequests.length === 0) {
this.disposeDelayer.trigger(() => this.disposeClient());
diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
index 2a3a7f0d15a..8341fd31256 100644
--- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
@@ -152,6 +152,15 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
DOM.EventHelper.stop(e, true);
this.hide(HideReason.CANCELED);
+ } else if (keyboardEvent.keyCode === KeyCode.Tab && !keyboardEvent.altKey && !keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {
+ const stops = e.currentTarget.querySelectorAll('input, .monaco-tree, .monaco-tree-row.focused .action-label.icon');
+ if (keyboardEvent.shiftKey && keyboardEvent.target === stops[0]) {
+ DOM.EventHelper.stop(e, true);
+ stops[stops.length - 1].focus();
+ } else if (!keyboardEvent.shiftKey && keyboardEvent.target === stops[stops.length - 1]) {
+ DOM.EventHelper.stop(e, true);
+ stops[0].focus();
+ }
}
})
.on(DOM.EventType.CONTEXT_MENU, (e: Event) => DOM.EventHelper.stop(e, true)) // Do this to fix an issue on Mac where the menu goes into the way
@@ -243,7 +252,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
horizontalScrollMode: ScrollbarVisibility.Hidden,
ariaLabel: nls.localize('treeAriaLabel', "Quick Picker"),
keyboardSupport: this.options.keyboardSupport,
- preventRootFocus: true
+ preventRootFocus: false
}));
this.treeElement = this.tree.getHTMLElement();
@@ -348,7 +357,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
if (keyboardEvent.keyCode === KeyCode.DownArrow || keyboardEvent.keyCode === KeyCode.UpArrow || keyboardEvent.keyCode === KeyCode.PageDown || keyboardEvent.keyCode === KeyCode.PageUp) {
DOM.EventHelper.stop(e, true);
this.navigateInTree(keyboardEvent.keyCode, keyboardEvent.shiftKey);
- this.inputBox.inputElement.focus();
+ this.treeElement.focus();
}
});
return this.builder.getHTMLElement();
diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts
index 4979ce9df99..482676324a4 100644
--- a/src/vs/code/electron-main/windows.ts
+++ b/src/vs/code/electron-main/windows.ts
@@ -851,7 +851,7 @@ export class WindowsManager implements IWindowsMainService {
if (cli['folder-uri'] && cli['folder-uri'].length) {
const arg = cli['folder-uri'];
const folderUris: string[] = typeof arg === 'string' ? [arg] : arg;
- pathsToOpen.push(...arrays.coalesce(folderUris.map(candidate => this.parseUri(URI.parse(candidate), { ignoreFileNotFound: true, gotoLineMode: cli.goto }))));
+ pathsToOpen.push(...arrays.coalesce(folderUris.map(candidate => this.parseUri(this.parseFolderUriArg(candidate), { ignoreFileNotFound: true, gotoLineMode: cli.goto }))));
}
// folder or file paths
@@ -963,8 +963,16 @@ export class WindowsManager implements IWindowsMainService {
return restoreWindows;
}
+ private parseFolderUriArg(arg: string): URI {
+ // Do not support if user has passed folder path on Windows
+ if (isWindows && /^([a-z])\:(.*)$/i.test(arg)) {
+ return null;
+ }
+ return URI.parse(arg);
+ }
+
private parseUri(anyUri: URI, options?: { ignoreFileNotFound?: boolean, gotoLineMode?: boolean, forceOpenWorkspaceAsFile?: boolean; }): IPathToOpen {
- if (!anyUri) {
+ if (!anyUri || !anyUri.scheme) {
return null;
}
@@ -1110,7 +1118,7 @@ export class WindowsManager implements IWindowsMainService {
if (openConfig.cli['folder-uri']) {
const arg = openConfig.cli['folder-uri'];
const folderUris: string[] = typeof arg === 'string' ? [arg] : arg;
- if (folderUris.some(uri => !!findWindowOnWorkspaceOrFolderUri(WindowsManager.WINDOWS, URI.parse(uri)))) {
+ if (folderUris.some(uri => !!findWindowOnWorkspaceOrFolderUri(WindowsManager.WINDOWS, this.parseFolderUriArg(uri)))) {
openConfig.cli['folder-uri'] = [];
}
}
diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts
index 05c024d8d8c..083e0fd94a6 100644
--- a/src/vs/editor/browser/controller/coreCommands.ts
+++ b/src/vs/editor/browser/controller/coreCommands.ts
@@ -5,6 +5,7 @@
'use strict';
+import * as nls from 'vs/nls';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
@@ -16,7 +17,7 @@ import { registerEditorCommand, ICommandOptions, EditorCommand, Command } from '
import { IColumnSelectResult, ColumnSelection } from 'vs/editor/common/controller/cursorColumnSelection';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import H = editorCommon.Handler;
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -26,8 +27,9 @@ import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations
import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperations';
import { VerticalRevealType } from 'vs/editor/common/view/viewEvents';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { MenuId } from 'vs/platform/actions/common/actions';
-const CORE_WEIGHT = KeybindingsRegistry.WEIGHT.editorCore();
+const CORE_WEIGHT = KeybindingWeight.EditorCore;
export abstract class CoreEditorCommand extends EditorCommand {
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
@@ -1620,7 +1622,7 @@ function findFocusedEditor(accessor: ServicesAccessor): ICodeEditor {
}
function registerCommand(command: Command) {
- KeybindingsRegistry.registerCommandAndKeybindingRule(command.toCommandAndKeybindingRule(CORE_WEIGHT));
+ command.register();
}
/**
@@ -1721,6 +1723,12 @@ registerCommand(new EditorOrNativeTextInputCommand({
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_Z
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '1_do',
+ title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"),
+ order: 1
}
}));
registerCommand(new EditorHandlerCommand('default:' + H.Undo, H.Undo));
@@ -1736,6 +1744,12 @@ registerCommand(new EditorOrNativeTextInputCommand({
primary: KeyMod.CtrlCmd | KeyCode.KEY_Y,
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z],
mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z }
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '1_do',
+ title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"),
+ order: 2
}
}));
registerCommand(new EditorHandlerCommand('default:' + H.Redo, H.Redo));
diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts
index 6d9e1f04119..1d45a7e2999 100644
--- a/src/vs/editor/browser/editorExtensions.ts
+++ b/src/vs/editor/browser/editorExtensions.ts
@@ -9,13 +9,13 @@ import URI from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { ServicesAccessor, IConstructorSignature1 } from 'vs/platform/instantiation/common/instantiation';
import { CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
-import { KeybindingsRegistry, ICommandAndKeybindingRule, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingsRegistry, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Position } from 'vs/editor/common/core/position';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IModelService } from 'vs/editor/common/services/modelService';
-import { MenuId, MenuRegistry, IMenuItem } from 'vs/platform/actions/common/actions';
+import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -29,53 +29,83 @@ export type IEditorContributionCtor = IConstructorSignature1 this.runCommand(accessor, args),
- weight: weight,
- when: kbWhen,
- primary: kbOpts.primary,
- secondary: kbOpts.secondary,
- win: kbOpts.win,
- linux: kbOpts.linux,
- mac: kbOpts.mac,
- description: this._description
- };
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
+ id: this.id,
+ handler: (accessor, args) => this.runCommand(accessor, args),
+ weight: this._kbOpts.weight,
+ when: kbWhen,
+ primary: this._kbOpts.primary,
+ secondary: this._kbOpts.secondary,
+ win: this._kbOpts.win,
+ linux: this._kbOpts.linux,
+ mac: this._kbOpts.mac,
+ description: this._description
+ });
+
+ } else {
+
+ CommandsRegistry.registerCommand({
+ id: this.id,
+ handler: (accessor, args) => this.runCommand(accessor, args),
+ description: this._description
+ });
+ }
}
public abstract runCommand(accessor: ServicesAccessor, args: any): void | TPromise;
@@ -144,8 +174,8 @@ export abstract class EditorCommand extends Command {
//#region EditorAction
export interface IEditorCommandMenuOptions {
- group?: string;
- order?: number;
+ group: string;
+ order: number;
when?: ContextKeyExpr;
}
export interface IActionOptions extends ICommandOptions {
@@ -166,20 +196,21 @@ export abstract class EditorAction extends EditorCommand {
this.menuOpts = opts.menuOpts;
}
- public toMenuItem(): IMenuItem {
- if (!this.menuOpts) {
- return null;
+ public register(): void {
+
+ if (this.menuOpts) {
+ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
+ command: {
+ id: this.id,
+ title: this.label
+ },
+ when: ContextKeyExpr.and(this.precondition, this.menuOpts.when),
+ group: this.menuOpts.group,
+ order: this.menuOpts.order
+ });
}
- return {
- command: {
- id: this.id,
- title: this.label
- },
- when: ContextKeyExpr.and(this.precondition, this.menuOpts.when),
- group: this.menuOpts.group,
- order: this.menuOpts.order
- };
+ super.register();
}
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise {
@@ -295,14 +326,7 @@ class EditorContributionRegistry {
}
public registerEditorAction(action: EditorAction) {
-
- let menuItem = action.toMenuItem();
- if (menuItem) {
- MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem);
- }
-
- KeybindingsRegistry.registerCommandAndKeybindingRule(action.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib()));
-
+ action.register();
this.editorActions.push(action);
}
@@ -315,7 +339,7 @@ class EditorContributionRegistry {
}
public registerEditorCommand(editorCommand: EditorCommand) {
- KeybindingsRegistry.registerCommandAndKeybindingRule(editorCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib()));
+ editorCommand.register();
this.editorCommands[editorCommand.id] = editorCommand;
}
diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts
index fee65bb4dc3..3f20b8b4a2d 100644
--- a/src/vs/editor/browser/widget/codeEditorWidget.ts
+++ b/src/vs/editor/browser/widget/codeEditorWidget.ts
@@ -1550,6 +1550,8 @@ class EditorContextKeysManager extends Disposable {
private _editorReadonly: IContextKey;
private _hasMultipleSelections: IContextKey;
private _hasNonEmptySelection: IContextKey;
+ private _canUndo: IContextKey;
+ private _canRedo: IContextKey;
constructor(
editor: CodeEditorWidget,
@@ -1567,6 +1569,8 @@ class EditorContextKeysManager extends Disposable {
this._editorReadonly = EditorContextKeys.readOnly.bindTo(contextKeyService);
this._hasMultipleSelections = EditorContextKeys.hasMultipleSelections.bindTo(contextKeyService);
this._hasNonEmptySelection = EditorContextKeys.hasNonEmptySelection.bindTo(contextKeyService);
+ this._canUndo = EditorContextKeys.canUndo.bindTo(contextKeyService);
+ this._canRedo = EditorContextKeys.canRedo.bindTo(contextKeyService);
this._register(this._editor.onDidChangeConfiguration(() => this._updateFromConfig()));
this._register(this._editor.onDidChangeCursorSelection(() => this._updateFromSelection()));
@@ -1574,10 +1578,13 @@ class EditorContextKeysManager extends Disposable {
this._register(this._editor.onDidBlurEditorWidget(() => this._updateFromFocus()));
this._register(this._editor.onDidFocusEditorText(() => this._updateFromFocus()));
this._register(this._editor.onDidBlurEditorText(() => this._updateFromFocus()));
+ this._register(this._editor.onDidChangeModel(() => this._updateFromModel()));
+ this._register(this._editor.onDidChangeConfiguration(() => this._updateFromModel()));
this._updateFromConfig();
this._updateFromSelection();
this._updateFromFocus();
+ this._updateFromModel();
}
private _updateFromConfig(): void {
@@ -1603,6 +1610,12 @@ class EditorContextKeysManager extends Disposable {
this._editorTextFocus.set(this._editor.hasTextFocus() && !this._editor.isSimpleWidget);
this._textInputFocus.set(this._editor.hasTextFocus());
}
+
+ private _updateFromModel(): void {
+ const model = this._editor.getModel();
+ this._canUndo.set(model && model.canUndo());
+ this._canRedo.set(model && model.canRedo());
+ }
}
export class EditorModeContext extends Disposable {
diff --git a/src/vs/editor/browser/widget/diffReview.ts b/src/vs/editor/browser/widget/diffReview.ts
index c06799df4c5..fe42bf6cc0d 100644
--- a/src/vs/editor/browser/widget/diffReview.ts
+++ b/src/vs/editor/browser/widget/diffReview.ts
@@ -30,6 +30,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ITextModel, TextModelResolvedOptions } from 'vs/editor/common/model';
import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
const DIFF_LINES_PADDING = 3;
@@ -810,7 +811,8 @@ class DiffReviewNext extends EditorAction {
precondition: ContextKeyExpr.has('isInDiffEditor'),
kbOpts: {
kbExpr: null,
- primary: KeyCode.F7
+ primary: KeyCode.F7,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -832,7 +834,8 @@ class DiffReviewPrev extends EditorAction {
precondition: ContextKeyExpr.has('isInDiffEditor'),
kbOpts: {
kbExpr: null,
- primary: KeyMod.Shift | KeyCode.F7
+ primary: KeyMod.Shift | KeyCode.F7,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts
index deb7e9526c3..adaf242cb6f 100644
--- a/src/vs/editor/common/config/commonEditorConfig.ts
+++ b/src/vs/editor/common/config/commonEditorConfig.ts
@@ -276,7 +276,7 @@ const editorConfiguration: IConfigurationNode = {
'editor.wordSeparators': {
'type': 'string',
'default': EDITOR_DEFAULTS.wordSeparators,
- 'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations")
+ 'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.")
},
'editor.tabSize': {
'type': 'number',
@@ -418,8 +418,14 @@ const editorConfiguration: IConfigurationNode = {
'editor.wrappingIndent': {
'type': 'string',
'enum': ['none', 'same', 'indent', 'deepIndent'],
+ enumDescriptions: [
+ nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."),
+ nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."),
+ nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."),
+ nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."),
+ ],
'default': 'same',
- 'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines. Can be one of 'none', 'same', 'indent' or 'deepIndent'.")
+ 'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."),
},
'editor.mouseWheelScrollSensitivity': {
'type': 'number',
@@ -510,13 +516,13 @@ const editorConfiguration: IConfigurationNode = {
'editor.suggestOnTriggerCharacters': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters,
- 'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters")
+ 'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters.")
},
'editor.acceptSuggestionOnEnter': {
'type': 'string',
'enum': ['on', 'smart', 'off'],
'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter,
- 'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change")
+ 'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change.")
},
'editor.acceptSuggestionOnCommitCharacter': {
'type': 'boolean',
@@ -560,13 +566,13 @@ const editorConfiguration: IConfigurationNode = {
'type': 'integer',
'default': 0,
'minimum': 0,
- 'description': nls.localize('suggestFontSize', "Font size for the suggest widget")
+ 'description': nls.localize('suggestFontSize', "Font size for the suggest widget.")
},
'editor.suggestLineHeight': {
'type': 'integer',
'default': 0,
'minimum': 0,
- 'description': nls.localize('suggestLineHeight', "Line height for the suggest widget")
+ 'description': nls.localize('suggestLineHeight', "Line height for the suggest widget.")
},
'editor.suggest.filterGraceful': {
type: 'boolean',
@@ -586,12 +592,12 @@ const editorConfiguration: IConfigurationNode = {
'editor.occurrencesHighlight': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.contribInfo.occurrencesHighlight,
- 'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences")
+ 'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.")
},
'editor.overviewRulerLanes': {
'type': 'integer',
'default': 3,
- 'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler")
+ 'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler.")
},
'editor.overviewRulerBorder': {
'type': 'boolean',
@@ -607,7 +613,7 @@ const editorConfiguration: IConfigurationNode = {
'editor.mouseWheelZoom': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.viewInfo.mouseWheelZoom,
- 'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl")
+ 'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl.")
},
'editor.cursorStyle': {
'type': 'string',
@@ -644,12 +650,12 @@ const editorConfiguration: IConfigurationNode = {
'editor.renderControlCharacters': {
'type': 'boolean',
default: EDITOR_DEFAULTS.viewInfo.renderControlCharacters,
- description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters")
+ description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters.")
},
'editor.renderIndentGuides': {
'type': 'boolean',
default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides,
- description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides")
+ description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides.")
},
'editor.highlightActiveIndentGuide': {
'type': 'boolean',
@@ -701,12 +707,12 @@ const editorConfiguration: IConfigurationNode = {
'editor.useTabStops': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.useTabStops,
- 'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops")
+ 'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops.")
},
'editor.trimAutoWhitespace': {
'type': 'boolean',
'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
- 'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace")
+ 'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace.")
},
'editor.stablePeek': {
'type': 'boolean',
diff --git a/src/vs/editor/common/editorContextKeys.ts b/src/vs/editor/common/editorContextKeys.ts
index e6cd1d9caf5..c306f76352c 100644
--- a/src/vs/editor/common/editorContextKeys.ts
+++ b/src/vs/editor/common/editorContextKeys.ts
@@ -30,6 +30,8 @@ export namespace EditorContextKeys {
export const tabMovesFocus = new RawContextKey('editorTabMovesFocus', false);
export const tabDoesNotMoveFocus: ContextKeyExpr = tabMovesFocus.toNegated();
export const isInEmbeddedEditor = new RawContextKey('isInEmbeddedEditor', undefined);
+ export const canUndo = new RawContextKey('canUndo', false);
+ export const canRedo = new RawContextKey('canRedo', false);
// -- mode context keys
export const languageId = new RawContextKey('editorLangId', undefined);
diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts
index e4a6ba3feed..d37319c25b5 100644
--- a/src/vs/editor/common/model.ts
+++ b/src/vs/editor/common/model.ts
@@ -1030,6 +1030,12 @@ export interface ITextModel {
*/
undo(): Selection[];
+ /**
+ * Is there anything in the undo stack?
+ * @internal
+ */
+ canUndo(): boolean;
+
/**
* Redo edit operations until the next stop point created by `pushStackElement`.
* The inverse edit operations will be pushed on the undo stack.
@@ -1037,6 +1043,12 @@ export interface ITextModel {
*/
redo(): Selection[];
+ /**
+ * Is there anything in the redo stack?
+ * @internal
+ */
+ canRedo(): boolean;
+
/**
* @deprecated Please use `onDidChangeContent` instead.
* An event emitted when the contents of the model have changed.
diff --git a/src/vs/editor/common/model/editStack.ts b/src/vs/editor/common/model/editStack.ts
index 13a955cf522..5f5e3066845 100644
--- a/src/vs/editor/common/model/editStack.ts
+++ b/src/vs/editor/common/model/editStack.ts
@@ -210,6 +210,10 @@ export class EditStack {
return null;
}
+ public canUndo(): boolean {
+ return (this.past.length > 0);
+ }
+
public redo(): IUndoRedoResult {
if (this.future.length > 0) {
@@ -233,4 +237,8 @@ export class EditStack {
return null;
}
+
+ public canRedo(): boolean {
+ return (this.future.length > 0);
+ }
}
diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts
index 1a4005d6a1b..7bddfeb4441 100644
--- a/src/vs/editor/common/model/textModel.ts
+++ b/src/vs/editor/common/model/textModel.ts
@@ -1416,6 +1416,10 @@ export class TextModel extends Disposable implements model.ITextModel {
}
}
+ public canUndo(): boolean {
+ return this._commandManager.canUndo();
+ }
+
private _redo(): Selection[] {
this._isRedoing = true;
let r = this._commandManager.redo();
@@ -1441,6 +1445,10 @@ export class TextModel extends Disposable implements model.ITextModel {
}
}
+ public canRedo(): boolean {
+ return this._commandManager.canRedo();
+ }
+
//#endregion
//#region Decorations
diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts
index b2573d26fa0..5ed915fe01a 100644
--- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts
+++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts
@@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { TrackedRangeStickiness, IModelDeltaDecoration, OverviewRulerLane } from 'vs/editor/common/model';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
const overviewRulerBracketMatchForeground = registerColor('editorOverviewRuler.bracketMatchForeground', { dark: '#A0A0A0', light: '#A0A0A0', hc: '#A0A0A0' }, nls.localize('overviewRulerBracketMatchForeground', 'Overview ruler marker color for matching brackets.'));
@@ -34,7 +35,8 @@ class JumpToBracketAction extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/caretOperations/transpose.ts b/src/vs/editor/contrib/caretOperations/transpose.ts
index 6523327b253..ee59ca9c28d 100644
--- a/src/vs/editor/contrib/caretOperations/transpose.ts
+++ b/src/vs/editor/contrib/caretOperations/transpose.ts
@@ -15,6 +15,7 @@ import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ITextModel } from 'vs/editor/common/model';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
class TransposeLettersAction extends EditorAction {
@@ -67,7 +68,8 @@ class TransposeLettersAction extends EditorAction {
primary: 0,
mac: {
primary: KeyMod.WinCtrl | KeyCode.KEY_T
- }
+ },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts
index 97f62935e1f..4d0ec22210d 100644
--- a/src/vs/editor/contrib/clipboard/clipboard.ts
+++ b/src/vs/editor/contrib/clipboard/clipboard.ts
@@ -16,6 +16,8 @@ import { registerEditorAction, IActionOptions, EditorAction, ICommandKeybindings
import { CopyOptions } from 'vs/editor/browser/controller/textAreaInput';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { MenuId } from 'vs/platform/actions/common/actions';
const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste';
@@ -62,7 +64,8 @@ class ExecCommandCutAction extends ExecCommandAction {
let kbOpts: ICommandKeybindingsOptions = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_X,
- win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] }
+ win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] },
+ weight: KeybindingWeight.EditorContrib
};
// Do not bind cut keybindings in the browser,
// since browsers do that for us and it avoids security prompts
@@ -78,6 +81,12 @@ class ExecCommandCutAction extends ExecCommandAction {
menuOpts: {
group: CLIPBOARD_CONTEXT_MENU_GROUP,
order: 1
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '2_ccp',
+ title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"),
+ order: 1
}
});
}
@@ -99,7 +108,8 @@ class ExecCommandCopyAction extends ExecCommandAction {
let kbOpts: ICommandKeybindingsOptions = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
- win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] }
+ win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] },
+ weight: KeybindingWeight.EditorContrib
};
// Do not bind copy keybindings in the browser,
// since browsers do that for us and it avoids security prompts
@@ -116,6 +126,12 @@ class ExecCommandCopyAction extends ExecCommandAction {
menuOpts: {
group: CLIPBOARD_CONTEXT_MENU_GROUP,
order: 2
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '2_ccp',
+ title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"),
+ order: 2
}
});
}
@@ -137,7 +153,8 @@ class ExecCommandPasteAction extends ExecCommandAction {
let kbOpts: ICommandKeybindingsOptions = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
- win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] }
+ win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] },
+ weight: KeybindingWeight.EditorContrib
};
// Do not bind paste keybindings in the browser,
// since browsers do that for us and it avoids security prompts
@@ -154,6 +171,12 @@ class ExecCommandPasteAction extends ExecCommandAction {
menuOpts: {
group: CLIPBOARD_CONTEXT_MENU_GROUP,
order: 3
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '2_ccp',
+ title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"),
+ order: 3
}
});
}
@@ -169,7 +192,8 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
- primary: null
+ primary: null,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts
index 53870292126..1f229bfbfbc 100644
--- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts
+++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts
@@ -26,6 +26,7 @@ import { CodeActionModel, CodeActionsComputeEvent, SUPPORTED_CODE_ACTIONS } from
import { CodeActionAutoApply, CodeActionFilter, CodeActionKind } from './codeActionTrigger';
import { CodeActionContextMenu } from './codeActionWidget';
import { LightBulbWidget } from './lightBulbWidget';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
function contextKeyForSupportedActions(kind: CodeActionKind) {
return ContextKeyExpr.regex(
@@ -192,7 +193,8 @@ export class QuickFixAction extends EditorAction {
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.US_DOT
+ primary: KeyMod.CtrlCmd | KeyCode.US_DOT,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -272,7 +274,8 @@ export class RefactorAction extends EditorAction {
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R,
mac: {
primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R
- }
+ },
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: '1_modification',
@@ -335,7 +338,8 @@ export class OrganizeImportsAction extends EditorAction {
contextKeyForSupportedActions(CodeActionKind.SourceOrganizeImports)),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts
index b570ff1f041..264e8527e52 100644
--- a/src/vs/editor/contrib/comment/comment.ts
+++ b/src/vs/editor/contrib/comment/comment.ts
@@ -12,6 +12,8 @@ import { registerEditorAction, IActionOptions, EditorAction, ServicesAccessor }
import { BlockCommentCommand } from './blockCommentCommand';
import { LineCommentCommand, Type } from './lineCommentCommand';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { MenuId } from 'vs/platform/actions/common/actions';
abstract class CommentLineAction extends EditorAction {
@@ -52,7 +54,14 @@ class ToggleCommentLineAction extends CommentLineAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.US_SLASH
+ primary: KeyMod.CtrlCmd | KeyCode.US_SLASH,
+ weight: KeybindingWeight.EditorContrib
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '5_insert',
+ title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment"),
+ order: 1
}
});
}
@@ -67,7 +76,8 @@ class AddLineCommentAction extends CommentLineAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -82,7 +92,8 @@ class RemoveLineCommentAction extends CommentLineAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -99,7 +110,14 @@ class BlockCommentAction extends EditorAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A,
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }
+ linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A },
+ weight: KeybindingWeight.EditorContrib
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '5_insert',
+ title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment"),
+ order: 2
}
});
}
diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts
index a3467f32a75..75de2e1c6d1 100644
--- a/src/vs/editor/contrib/contextmenu/contextmenu.ts
+++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts
@@ -20,6 +20,7 @@ import { IEditorContribution, IScrollEvent, ScrollType } from 'vs/editor/common/
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export interface IPosition {
x: number;
@@ -227,7 +228,8 @@ class ShowContextMenu extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
- primary: KeyMod.Shift | KeyCode.F10
+ primary: KeyMod.Shift | KeyCode.F10,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts
index dec489e7d14..cd80e4025a1 100644
--- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts
+++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts
@@ -12,6 +12,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
class CursorState {
readonly selections: Selection[];
@@ -118,7 +119,8 @@ export class CursorUndo extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
- primary: KeyMod.CtrlCmd | KeyCode.KEY_U
+ primary: KeyMod.CtrlCmd | KeyCode.KEY_U,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/documentSymbols/outlineModel.ts b/src/vs/editor/contrib/documentSymbols/outlineModel.ts
index 28db38d0d47..38157732bfa 100644
--- a/src/vs/editor/contrib/documentSymbols/outlineModel.ts
+++ b/src/vs/editor/contrib/documentSymbols/outlineModel.ts
@@ -21,10 +21,14 @@ export abstract class TreeElement {
abstract id: string;
abstract children: { [id: string]: TreeElement };
- abstract parent: TreeElement | any;
+ abstract parent: TreeElement;
abstract adopt(newParent: TreeElement): TreeElement;
+ remove(): void {
+ delete this.parent.children[this.id];
+ }
+
static findId(candidate: DocumentSymbol | string, container: TreeElement): string {
// complex id-computation which contains the origin/extension,
// the parent path, and some dedupe logic when names collide
@@ -73,6 +77,13 @@ export abstract class TreeElement {
}
return res;
}
+
+ static empty(element: TreeElement): boolean {
+ for (const _key in element.children) {
+ return false;
+ }
+ return true;
+ }
}
export class OutlineElement extends TreeElement {
@@ -297,7 +308,11 @@ export class OutlineModel extends TreeElement {
onUnexpectedExternalError(err);
return group;
}).then(group => {
- result._groups[id] = group;
+ if (!TreeElement.empty(group)) {
+ result._groups[id] = group;
+ } else {
+ group.remove();
+ }
});
});
diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts
index 73bf698e3b8..5a43011b332 100644
--- a/src/vs/editor/contrib/find/findController.ts
+++ b/src/vs/editor/contrib/find/findController.ts
@@ -23,8 +23,9 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { FindWidget, IFindController } from 'vs/editor/contrib/find/findWidget';
import { FindOptionsWidget } from 'vs/editor/contrib/find/findOptionsWidget';
import { IThemeService } from 'vs/platform/theme/common/themeService';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { optional } from 'vs/platform/instantiation/common/instantiation';
+import { MenuId } from 'vs/platform/actions/common/actions';
export function getSelectionSearchString(editor: ICodeEditor): string {
let selection = editor.getSelection();
@@ -386,7 +387,14 @@ export class StartFindAction extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: null,
- primary: KeyMod.CtrlCmd | KeyCode.KEY_F
+ primary: KeyMod.CtrlCmd | KeyCode.KEY_F,
+ weight: KeybindingWeight.EditorContrib
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '3_find',
+ title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"),
+ order: 1
}
});
}
@@ -418,7 +426,8 @@ export class StartFindWithSelectionAction extends EditorAction {
primary: null,
mac: {
primary: KeyMod.CtrlCmd | KeyCode.KEY_E,
- }
+ },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -467,7 +476,8 @@ export class NextMatchFindAction extends MatchFindAction {
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyCode.F3,
- mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] }
+ mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -488,7 +498,8 @@ export class PreviousMatchFindAction extends MatchFindAction {
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.Shift | KeyCode.F3,
- mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] }
+ mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -533,7 +544,8 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.CtrlCmd | KeyCode.F3
+ primary: KeyMod.CtrlCmd | KeyCode.F3,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -553,7 +565,8 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -574,7 +587,14 @@ export class StartFindReplaceAction extends EditorAction {
kbOpts: {
kbExpr: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_H,
- mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }
+ mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F },
+ weight: KeybindingWeight.EditorContrib
+ },
+ menubarOpts: {
+ menuId: MenuId.MenubarEditMenu,
+ group: '3_find',
+ title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace"),
+ order: 2
}
});
}
@@ -624,7 +644,7 @@ registerEditorCommand(new FindCommand({
precondition: CONTEXT_FIND_WIDGET_VISIBLE,
handler: x => x.closeFindWidget(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
@@ -636,7 +656,7 @@ registerEditorCommand(new FindCommand({
precondition: null,
handler: x => x.toggleCaseSensitive(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: ToggleCaseSensitiveKeybinding.primary,
mac: ToggleCaseSensitiveKeybinding.mac,
@@ -650,7 +670,7 @@ registerEditorCommand(new FindCommand({
precondition: null,
handler: x => x.toggleWholeWords(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: ToggleWholeWordKeybinding.primary,
mac: ToggleWholeWordKeybinding.mac,
@@ -664,7 +684,7 @@ registerEditorCommand(new FindCommand({
precondition: null,
handler: x => x.toggleRegex(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: ToggleRegexKeybinding.primary,
mac: ToggleRegexKeybinding.mac,
@@ -678,7 +698,7 @@ registerEditorCommand(new FindCommand({
precondition: null,
handler: x => x.toggleSearchScope(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: ToggleSearchScopeKeybinding.primary,
mac: ToggleSearchScopeKeybinding.mac,
@@ -692,7 +712,7 @@ registerEditorCommand(new FindCommand({
precondition: CONTEXT_FIND_WIDGET_VISIBLE,
handler: x => x.replace(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_1
}
@@ -703,7 +723,7 @@ registerEditorCommand(new FindCommand({
precondition: CONTEXT_FIND_WIDGET_VISIBLE,
handler: x => x.replaceAll(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter
}
@@ -714,7 +734,7 @@ registerEditorCommand(new FindCommand({
precondition: CONTEXT_FIND_WIDGET_VISIBLE,
handler: x => x.selectAllMatches(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(5),
+ weight: KeybindingWeight.EditorContrib + 5,
kbExpr: EditorContextKeys.focus,
primary: KeyMod.Alt | KeyCode.Enter
}
diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts
index 43a305a49bc..a2a57574264 100644
--- a/src/vs/editor/contrib/folding/folding.ts
+++ b/src/vs/editor/contrib/folding/folding.ts
@@ -32,6 +32,7 @@ import { FoldingRangeProviderRegistry, FoldingRangeKind } from 'vs/editor/common
import { SyntaxRangeProvider, ID_SYNTAX_PROVIDER } from './syntaxRangeProvider';
import { CancellationToken } from 'vs/base/common/cancellation';
import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/folding/intializingRangeProvider';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export const ID = 'editor.contrib.folding';
@@ -486,7 +487,8 @@ class UnfoldAction extends FoldingAction {
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET,
mac: {
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_CLOSE_SQUARE_BRACKET
- }
+ },
+ weight: KeybindingWeight.EditorContrib
},
description: {
description: 'Unfold the content in the editor',
@@ -526,7 +528,8 @@ class UnFoldRecursivelyAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -549,7 +552,8 @@ class FoldAction extends FoldingAction {
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET,
mac: {
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_OPEN_SQUARE_BRACKET
- }
+ },
+ weight: KeybindingWeight.EditorContrib
},
description: {
description: 'Fold the content in the editor',
@@ -589,7 +593,8 @@ class FoldRecursivelyAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -610,7 +615,8 @@ class FoldAllBlockCommentsAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -638,7 +644,8 @@ class FoldAllRegionsAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -666,7 +673,8 @@ class UnfoldAllRegionsAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -694,7 +702,8 @@ class FoldAllAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -714,7 +723,8 @@ class UnfoldAllAction extends FoldingAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -757,7 +767,8 @@ for (let i = 1; i <= 7; i++) {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i))
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)),
+ weight: KeybindingWeight.EditorContrib
}
})
);
diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts
index 985dd3e900e..25dee8a028a 100644
--- a/src/vs/editor/contrib/format/formatActions.ts
+++ b/src/vs/editor/contrib/format/formatActions.ts
@@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ISingleEditOperation } from 'vs/editor/common/model';
import { INotificationService } from 'vs/platform/notification/common/notification';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
function alertFormattingEdits(edits: ISingleEditOperation[]): void {
@@ -310,7 +311,8 @@ export class FormatDocumentAction extends AbstractFormatAction {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F,
// secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D)],
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I }
+ linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I },
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
when: EditorContextKeys.hasDocumentFormattingProvider,
@@ -341,7 +343,8 @@ export class FormatSelectionAction extends AbstractFormatAction {
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasNonEmptySelection),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F),
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection),
diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
index 981b9fc99dc..667e77dbf2d 100644
--- a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
+++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
@@ -25,6 +25,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ITextModel, IWordAtPosition } from 'vs/editor/common/model';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { createCancelablePromise } from 'vs/base/common/async';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class DefinitionActionConfig {
@@ -191,7 +192,8 @@ export class GoToDefinitionAction extends DefinitionAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: goToDeclarationKb
+ primary: goToDeclarationKb,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: 'navigation',
@@ -215,7 +217,8 @@ export class OpenDefinitionToSideAction extends DefinitionAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -234,7 +237,8 @@ export class PeekDefinitionAction extends DefinitionAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Alt | KeyCode.F12,
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 }
+ linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 },
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: 'navigation',
@@ -274,7 +278,8 @@ export class GoToImplementationAction extends ImplementationAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.F12
+ primary: KeyMod.CtrlCmd | KeyCode.F12,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -294,7 +299,8 @@ export class PeekImplementationAction extends ImplementationAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -330,7 +336,8 @@ export class GoToTypeDefinitionAction extends TypeDefinitionAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: 0
+ primary: 0,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: 'navigation',
@@ -354,7 +361,8 @@ export class PeekTypeDefinitionAction extends TypeDefinitionAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: 0
+ primary: 0,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts
index 1c56024bc20..2ccee5cba7a 100644
--- a/src/vs/editor/contrib/gotoError/gotoError.ts
+++ b/src/vs/editor/contrib/gotoError/gotoError.ts
@@ -19,7 +19,7 @@ import { registerEditorAction, registerEditorContribution, ServicesAccessor, IAc
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { MarkerNavigationWidget } from './gotoErrorWidget';
import { compare } from 'vs/base/common/strings';
import { binarySearch } from 'vs/base/common/arrays';
@@ -401,7 +401,8 @@ class NextMarkerInFilesAction extends MarkerNavigationAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyCode.F8
+ primary: KeyCode.F8,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -416,7 +417,8 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.Shift | KeyCode.F8
+ primary: KeyMod.Shift | KeyCode.F8,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -437,7 +439,7 @@ registerEditorCommand(new MarkerCommand({
precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE,
handler: x => x.closeMarkersNavigation(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(50),
+ weight: KeybindingWeight.EditorContrib + 50,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts
index 45f39711585..cfef3c6c719 100644
--- a/src/vs/editor/contrib/hover/hover.ts
+++ b/src/vs/editor/contrib/hover/hover.ts
@@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
import { IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget';
import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class ModesHoverController implements IEditorContribution {
@@ -250,7 +251,8 @@ class ShowHoverAction extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I),
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
index 3127c005bfe..eba360f0676 100644
--- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
+++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
@@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async';
import { onUnexpectedError } from 'vs/base/common/errors';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
class InPlaceReplaceController implements IEditorContribution {
@@ -142,7 +143,8 @@ class InPlaceReplaceUp extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -166,7 +168,8 @@ class InPlaceReplaceDown extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts
index 7f2c9fb66c4..4171729014e 100644
--- a/src/vs/editor/contrib/linesOperations/linesOperations.ts
+++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts
@@ -23,6 +23,7 @@ import { MoveLinesCommand } from './moveLinesCommand';
import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations';
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
// copy lines
@@ -60,7 +61,8 @@ class CopyLinesUpAction extends AbstractCopyLinesAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow,
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }
+ linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -76,7 +78,8 @@ class CopyLinesDownAction extends AbstractCopyLinesAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow,
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }
+ linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -119,7 +122,8 @@ class MoveLinesUpAction extends AbstractMoveLinesAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Alt | KeyCode.UpArrow,
- linux: { primary: KeyMod.Alt | KeyCode.UpArrow }
+ linux: { primary: KeyMod.Alt | KeyCode.UpArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -135,7 +139,8 @@ class MoveLinesDownAction extends AbstractMoveLinesAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Alt | KeyCode.DownArrow,
- linux: { primary: KeyMod.Alt | KeyCode.DownArrow }
+ linux: { primary: KeyMod.Alt | KeyCode.DownArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -204,7 +209,8 @@ export class TrimTrailingWhitespaceAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -245,7 +251,8 @@ class DeleteLinesAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -314,7 +321,8 @@ export class IndentLinesAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET
+ primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -335,7 +343,8 @@ class OutdentLinesAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET
+ primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -354,7 +363,8 @@ export class InsertLineBeforeAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -374,7 +384,8 @@ export class InsertLineAfterAction extends EditorAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.Enter
+ primary: KeyMod.CtrlCmd | KeyCode.Enter,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -434,7 +445,8 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: null,
- mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }
+ mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -502,7 +514,8 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: null,
- mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] }
+ mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -559,7 +572,8 @@ export class JoinLinesAction extends EditorAction {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: 0,
- mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J }
+ mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts
index e80d0f6b90c..38ace15a614 100644
--- a/src/vs/editor/contrib/message/messageController.ts
+++ b/src/vs/editor/contrib/message/messageController.ts
@@ -19,7 +19,7 @@ import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/cont
import { IPosition } from 'vs/editor/common/core/position';
import { registerThemingParticipant, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { inputValidationInfoBorder, inputValidationInfoBackground } from 'vs/platform/theme/common/colorRegistry';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class MessageController extends Disposable implements editorCommon.IEditorContribution {
@@ -114,7 +114,7 @@ registerEditorCommand(new MessageCommand({
precondition: MessageController.MESSAGE_VISIBLE,
handler: c => c.closeMessage(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
+ weight: KeybindingWeight.EditorContrib + 30,
primary: KeyCode.Escape
}
}));
diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts
index 0517d7061a5..ed677d9b80f 100644
--- a/src/vs/editor/contrib/multicursor/multicursor.ts
+++ b/src/vs/editor/contrib/multicursor/multicursor.ts
@@ -25,6 +25,7 @@ import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/com
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class InsertCursorAbove extends EditorAction {
@@ -40,7 +41,8 @@ export class InsertCursorAbove extends EditorAction {
linux: {
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow,
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow]
- }
+ },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -78,7 +80,8 @@ export class InsertCursorBelow extends EditorAction {
linux: {
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow,
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow]
- }
+ },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -112,7 +115,8 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -522,7 +526,8 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.CtrlCmd | KeyCode.KEY_D
+ primary: KeyMod.CtrlCmd | KeyCode.KEY_D,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -554,7 +559,8 @@ export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionCont
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D)
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -586,7 +592,8 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -604,7 +611,8 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction {
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyCode.F2
+ primary: KeyMod.CtrlCmd | KeyCode.F2,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: '1_modification',
diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts
index 92d7eb7a799..6ec4cda8857 100644
--- a/src/vs/editor/contrib/parameterHints/parameterHints.ts
+++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts
@@ -15,7 +15,7 @@ import { registerEditorAction, registerEditorContribution, ServicesAccessor, Edi
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ParameterHintsWidget } from './parameterHintsWidget';
import { Context } from 'vs/editor/contrib/parameterHints/provideSignatureHelp';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
class ParameterHintsController implements IEditorContribution {
@@ -68,7 +68,8 @@ export class TriggerParameterHintsAction extends EditorAction {
precondition: EditorContextKeys.hasSignatureHelpProvider,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -84,7 +85,7 @@ export class TriggerParameterHintsAction extends EditorAction {
registerEditorContribution(ParameterHintsController);
registerEditorAction(TriggerParameterHintsAction);
-const weight = KeybindingsRegistry.WEIGHT.editorContrib(75);
+const weight = KeybindingWeight.EditorContrib + 75;
const ParameterHintsCommand = EditorCommand.bindToContribution(ParameterHintsController.get);
diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts
index ff8515fdd1e..787b9d4760d 100644
--- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts
+++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { TPromise } from 'vs/base/common/winjs.base';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Position, IPosition } from 'vs/editor/common/core/position';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { registerEditorAction, ServicesAccessor, EditorAction, registerEditorContribution, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
@@ -70,7 +70,8 @@ export class ReferenceAction extends EditorAction {
EditorContextKeys.isInEmbeddedEditor.toNegated()),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.Shift | KeyCode.F12
+ primary: KeyMod.Shift | KeyCode.F12,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: 'navigation',
@@ -192,7 +193,7 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'goToNextReference',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
+ weight: KeybindingWeight.WorkbenchContrib + 50,
primary: KeyCode.F4,
when: ctxReferenceSearchVisible,
handler(accessor) {
@@ -204,7 +205,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'goToNextReferenceFromEmbeddedEditor',
- weight: KeybindingsRegistry.WEIGHT.editorContrib(50),
+ weight: KeybindingWeight.EditorContrib + 50,
primary: KeyCode.F4,
when: PeekContext.inPeekEditor,
handler(accessor) {
@@ -216,7 +217,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'goToPreviousReference',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
+ weight: KeybindingWeight.WorkbenchContrib + 50,
primary: KeyMod.Shift | KeyCode.F4,
when: ctxReferenceSearchVisible,
handler(accessor) {
@@ -228,7 +229,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'goToPreviousReferenceFromEmbeddedEditor',
- weight: KeybindingsRegistry.WEIGHT.editorContrib(50),
+ weight: KeybindingWeight.EditorContrib + 50,
primary: KeyMod.Shift | KeyCode.F4,
when: PeekContext.inPeekEditor,
handler(accessor) {
@@ -240,7 +241,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'closeReferenceSearch',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
+ weight: KeybindingWeight.WorkbenchContrib + 50,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')),
@@ -249,7 +250,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'closeReferenceSearchEditor',
- weight: KeybindingsRegistry.WEIGHT.editorContrib(-101),
+ weight: KeybindingWeight.EditorContrib - 101,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')),
@@ -258,7 +259,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'openReferenceToSide',
- weight: KeybindingsRegistry.WEIGHT.editorContrib(),
+ weight: KeybindingWeight.EditorContrib,
primary: KeyMod.CtrlCmd | KeyCode.Enter,
mac: {
primary: KeyMod.WinCtrl | KeyCode.Enter
diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts
index d83828e5695..c5eeedbb0e5 100644
--- a/src/vs/editor/contrib/rename/rename.ts
+++ b/src/vs/editor/contrib/rename/rename.ts
@@ -25,7 +25,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria';
import { Range } from 'vs/editor/common/core/range';
import { MessageController } from 'vs/editor/contrib/message/messageController';
import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorState';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import URI from 'vs/base/common/uri';
@@ -224,7 +224,8 @@ export class RenameAction extends EditorAction {
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasRenameProvider),
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyCode.F2
+ primary: KeyCode.F2,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: '1_modification',
@@ -269,7 +270,7 @@ registerEditorCommand(new RenameCommand({
precondition: CONTEXT_RENAME_INPUT_VISIBLE,
handler: x => x.acceptRenameInput(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(99),
+ weight: KeybindingWeight.EditorContrib + 99,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Enter
}
@@ -280,7 +281,7 @@ registerEditorCommand(new RenameCommand({
precondition: CONTEXT_RENAME_INPUT_VISIBLE,
handler: x => x.cancelRenameInput(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(99),
+ weight: KeybindingWeight.EditorContrib + 99,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts
index 7c25548d3c9..76b6057a039 100644
--- a/src/vs/editor/contrib/smartSelect/smartSelect.ts
+++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts
@@ -16,6 +16,7 @@ import { registerEditorAction, ServicesAccessor, IActionOptions, EditorAction, r
import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionSupport';
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
// --- selection state machine
@@ -173,7 +174,8 @@ class GrowSelectionAction extends AbstractSmartSelect {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow,
- mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow }
+ mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -189,7 +191,8 @@ class ShrinkSelectionAction extends AbstractSmartSelect {
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow,
- mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow }
+ mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/snippet/snippetController2.ts b/src/vs/editor/contrib/snippet/snippetController2.ts
index 3022a612e99..9a3a443b47a 100644
--- a/src/vs/editor/contrib/snippet/snippetController2.ts
+++ b/src/vs/editor/contrib/snippet/snippetController2.ts
@@ -18,7 +18,7 @@ import { Range } from 'vs/editor/common/core/range';
import { Choice } from 'vs/editor/contrib/snippet/snippetParser';
import { repeat } from 'vs/base/common/strings';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { ILogService } from 'vs/platform/log/common/log';
@@ -227,7 +227,7 @@ registerEditorCommand(new CommandCtor({
precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasNextTabstop),
handler: ctrl => ctrl.next(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
+ weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyCode.Tab
}
@@ -237,7 +237,7 @@ registerEditorCommand(new CommandCtor({
precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasPrevTabstop),
handler: ctrl => ctrl.prev(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
+ weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyCode.Tab
}
@@ -247,7 +247,7 @@ registerEditorCommand(new CommandCtor({
precondition: SnippetController2.InSnippetMode,
handler: ctrl => ctrl.cancel(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
+ weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
@@ -259,7 +259,7 @@ registerEditorCommand(new CommandCtor({
precondition: SnippetController2.InSnippetMode,
handler: ctrl => ctrl.finish(),
// kbOpts: {
- // weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
+ // weight: KeybindingWeight.EditorContrib + 30,
// kbExpr: EditorContextKeys.textFocus,
// primary: KeyCode.Enter,
// }
diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts
index f92c3459f73..e281a671244 100644
--- a/src/vs/editor/contrib/suggest/suggestController.ts
+++ b/src/vs/editor/contrib/suggest/suggestController.ts
@@ -26,7 +26,7 @@ import { Context as SuggestContext } from './suggest';
import { SuggestModel, State } from './suggestModel';
import { ICompletionItem } from './completionModel';
import { SuggestWidget, ISelectedSuggestion } from './suggestWidget';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { SuggestMemories } from 'vs/editor/contrib/suggest/suggestMemory';
class AcceptOnCharacterOracle {
@@ -325,7 +325,8 @@ export class TriggerSuggestAction extends EditorAction {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.Space,
- mac: { primary: KeyMod.WinCtrl | KeyCode.Space }
+ mac: { primary: KeyMod.WinCtrl | KeyCode.Space },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -344,7 +345,7 @@ export class TriggerSuggestAction extends EditorAction {
registerEditorContribution(SuggestController);
registerEditorAction(TriggerSuggestAction);
-const weight = KeybindingsRegistry.WEIGHT.editorContrib(90);
+const weight = KeybindingWeight.EditorContrib + 90;
const SuggestCommand = EditorCommand.bindToContribution(SuggestController.get);
diff --git a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts
index e3aa3349af1..87cb996bb1c 100644
--- a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts
+++ b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts
@@ -9,6 +9,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { TabFocus } from 'vs/editor/common/config/commonEditorConfig';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class ToggleTabFocusModeAction extends EditorAction {
@@ -23,7 +24,8 @@ export class ToggleTabFocusModeAction extends EditorAction {
kbOpts: {
kbExpr: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_M,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
index 7f21bc957a1..8c852574b12 100644
--- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
+++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
@@ -25,6 +25,7 @@ import { firstIndex, isFalsyOrEmpty } from 'vs/base/common/arrays';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ITextModel, TrackedRangeStickiness, OverviewRulerLane, IModelDeltaDecoration } from 'vs/editor/common/model';
import { CancellationToken } from 'vs/base/common/cancellation';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export const editorWordHighlight = registerColor('editor.wordHighlightBackground', { dark: '#575757B8', light: '#57575740', hc: null }, nls.localize('wordHighlight', 'Background color of a symbol during read-access, like reading a variable. The color must not be opaque to not hide underlying decorations.'), true);
export const editorWordHighlightStrong = registerColor('editor.wordHighlightStrongBackground', { dark: '#004972B8', light: '#0e639c40', hc: null }, nls.localize('wordHighlightStrong', 'Background color of a symbol during write-access, like writing to a variable. The color must not be opaque to not hide underlying decorations.'), true);
@@ -459,7 +460,8 @@ class NextWordHighlightAction extends WordHighlightNavigationAction {
precondition: ctxHasWordHighlights,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyCode.F7
+ primary: KeyCode.F7,
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -474,7 +476,8 @@ class PrevWordHighlightAction extends WordHighlightNavigationAction {
precondition: ctxHasWordHighlights,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
- primary: KeyMod.Shift | KeyCode.F7
+ primary: KeyMod.Shift | KeyCode.F7,
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts
index 528303ab72c..237cc0bde06 100644
--- a/src/vs/editor/contrib/wordOperations/wordOperations.ts
+++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts
@@ -19,6 +19,7 @@ import { getMapForWordSeparators, WordCharacterClassifier } from 'vs/editor/comm
import { CursorState } from 'vs/editor/common/controller/cursorCommon';
import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export interface MoveWordOptions extends ICommandOptions {
inSelectionMode: boolean;
@@ -100,7 +101,8 @@ export class CursorWordStartLeft extends WordLeftCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.LeftArrow,
- mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }
+ mac: { primary: KeyMod.Alt | KeyCode.LeftArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -138,7 +140,8 @@ export class CursorWordStartLeftSelect extends WordLeftCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow,
- mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }
+ mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -187,7 +190,8 @@ export class CursorWordEndRight extends WordRightCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.RightArrow,
- mac: { primary: KeyMod.Alt | KeyCode.RightArrow }
+ mac: { primary: KeyMod.Alt | KeyCode.RightArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -225,7 +229,8 @@ export class CursorWordEndRightSelect extends WordRightCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow,
- mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }
+ mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -330,7 +335,8 @@ export class DeleteWordLeft extends DeleteWordLeftCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
- mac: { primary: KeyMod.Alt | KeyCode.Backspace }
+ mac: { primary: KeyMod.Alt | KeyCode.Backspace },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -368,7 +374,8 @@ export class DeleteWordRight extends DeleteWordRightCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.Delete,
- mac: { primary: KeyMod.Alt | KeyCode.Delete }
+ mac: { primary: KeyMod.Alt | KeyCode.Delete },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts
index 28829ba7b31..229dbedfc18 100644
--- a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts
+++ b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts
@@ -15,6 +15,7 @@ import { WordNavigationType, WordPartOperations } from 'vs/editor/common/control
import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier';
import { DeleteWordCommand, MoveWordCommand } from '../wordOperations/wordOperations';
import { Position } from 'vs/editor/common/core/position';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class DeleteWordPartLeft extends DeleteWordCommand {
constructor() {
@@ -26,7 +27,8 @@ export class DeleteWordPartLeft extends DeleteWordCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -50,7 +52,8 @@ export class DeleteWordPartRight extends DeleteWordCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Delete,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -81,7 +84,8 @@ export class CursorWordPartLeft extends WordPartLeftCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -96,7 +100,8 @@ export class CursorWordPartLeftSelect extends WordPartLeftCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -117,7 +122,8 @@ export class CursorWordPartRight extends WordPartRightCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -132,7 +138,8 @@ export class CursorWordPartRightSelect extends WordPartRightCommand {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow,
- mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }
+ mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
index 7f6504e4607..b7b0b203953 100644
--- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
+++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
@@ -30,7 +30,7 @@ import URI from 'vs/base/common/uri';
import { Selection } from 'vs/editor/common/core/selection';
import * as browser from 'vs/base/browser/browser';
import { IEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey('accessibilityHelpWidgetVisible', false);
@@ -342,7 +342,8 @@ class ShowAccessibilityHelpAction extends EditorAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1)
+ primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1),
+ weight: KeybindingWeight.EditorContrib
}
});
}
@@ -366,7 +367,7 @@ registerEditorCommand(
precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE,
handler: x => x.hide(),
kbOpts: {
- weight: KeybindingsRegistry.WEIGHT.editorContrib(100),
+ weight: KeybindingWeight.EditorContrib + 100,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
diff --git a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
index 9f83d8111c9..28bf35f5a56 100644
--- a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
+++ b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
@@ -18,6 +18,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { ITextModel } from 'vs/editor/common/model';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
interface ParseResult {
position: Position;
@@ -153,7 +154,8 @@ export class GotoLineAction extends BaseEditorQuickOpenAction {
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_G,
- mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G }
+ mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G },
+ weight: KeybindingWeight.EditorContrib
}
});
}
diff --git a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
index e44e14c0da8..7fe59dd0453 100644
--- a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
+++ b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts
@@ -18,6 +18,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import * as browser from 'vs/base/browser/browser';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class EditorActionCommandEntry extends QuickOpenEntryGroup {
private key: string;
@@ -79,9 +80,12 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1)
+ primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1),
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
+ group: 'z_commands',
+ order: 1
}
});
}
diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
index 19eeda1c9cc..ebc954e1b47 100644
--- a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
+++ b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
@@ -22,6 +22,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Range, IRange } from 'vs/editor/common/core/range';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
+import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
let SCOPE_PREFIX = ':';
@@ -120,7 +121,8 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction {
precondition: EditorContextKeys.hasDocumentSymbolProvider,
kbOpts: {
kbExpr: EditorContextKeys.focus,
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O,
+ weight: KeybindingWeight.EditorContrib
},
menuOpts: {
group: 'navigation',
diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
index 5cc1c5b5bb7..84989938f78 100644
--- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
@@ -250,7 +250,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
const existingExtension = installed.filter(i => areSameExtensions(i.galleryIdentifier, extension.identifier))[0];
operation = existingExtension ? InstallOperation.Update : InstallOperation.Install;
return this.downloadInstallableExtension(extension, operation)
- .then(installableExtension => this.installExtension(installableExtension))
+ .then(installableExtension => this.installExtension(installableExtension).then(local => always(pfs.rimraf(installableExtension.zipPath), () => null).then(() => local)))
.then(local => this.installDependenciesAndPackExtensions(local, existingExtension)
.then(() => local, error => this.uninstall(local, true).then(() => TPromise.wrapError(error), () => TPromise.wrapError(error))));
})
@@ -331,7 +331,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
return this.galleryService.download(extension, operation)
.then(
zipPath => {
- this.logService.info('Downloaded extension:', extension.name);
+ this.logService.info('Downloaded extension:', extension.name, zipPath);
return validateLocalExtension(zipPath)
.then(
manifest => ({ zipPath, id: getLocalExtensionIdFromManifest(manifest), metadata }),
diff --git a/src/vs/platform/keybinding/common/keybindingsRegistry.ts b/src/vs/platform/keybinding/common/keybindingsRegistry.ts
index 39113558334..3d581b4e64f 100644
--- a/src/vs/platform/keybinding/common/keybindingsRegistry.ts
+++ b/src/vs/platform/keybinding/common/keybindingsRegistry.ts
@@ -57,6 +57,14 @@ export const enum KeybindingRuleSource {
Extension = 1
}
+export const enum KeybindingWeight {
+ EditorCore = 0,
+ EditorContrib = 100,
+ WorkbenchContrib = 200,
+ BuiltinExtension = 300,
+ ExternalExtension = 400
+}
+
export interface ICommandAndKeybindingRule extends IKeybindingRule {
handler: ICommandHandler;
description?: ICommandHandlerDescription;
@@ -67,14 +75,6 @@ export interface IKeybindingsRegistry {
registerKeybindingRule2(rule: IKeybindingRule2, source?: KeybindingRuleSource): void;
registerCommandAndKeybindingRule(desc: ICommandAndKeybindingRule, source?: KeybindingRuleSource): void;
getDefaultKeybindings(): IKeybindingItem[];
-
- WEIGHT: {
- editorCore(importance?: number): number;
- editorContrib(importance?: number): number;
- workbenchContrib(importance?: number): number;
- builtinExtension(importance?: number): number;
- externalExtension(importance?: number): number;
- };
}
class KeybindingsRegistryImpl implements IKeybindingsRegistry {
@@ -82,24 +82,6 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
private _keybindings: IKeybindingItem[];
private _keybindingsSorted: boolean;
- public WEIGHT = {
- editorCore: (importance: number = 0): number => {
- return 0 + importance;
- },
- editorContrib: (importance: number = 0): number => {
- return 100 + importance;
- },
- workbenchContrib: (importance: number = 0): number => {
- return 200 + importance;
- },
- builtinExtension: (importance: number = 0): number => {
- return 300 + importance;
- },
- externalExtension: (importance: number = 0): number => {
- return 400 + importance;
- }
- };
-
constructor() {
this._keybindings = [];
this._keybindingsSorted = true;
diff --git a/src/vs/platform/request/node/request.ts b/src/vs/platform/request/node/request.ts
index b8d501fa2b5..878a5c4a334 100644
--- a/src/vs/platform/request/node/request.ts
+++ b/src/vs/platform/request/node/request.ts
@@ -37,12 +37,12 @@ Registry.as(Extensions.Configuration)
'http.proxy': {
type: 'string',
pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+)(:\\d+)?/?$|^$',
- description: localize('proxy', "The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables")
+ description: localize('proxy', "The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables.")
},
'http.proxyStrictSSL': {
type: 'boolean',
default: true,
- description: localize('strictSSL', "Whether the proxy server certificate should be verified against the list of supplied CAs.")
+ description: localize('strictSSL', "Controls whether the proxy server certificate should be verified against the list of supplied CAs.")
},
'http.proxyAuthorization': {
type: ['null', 'string'],
diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts
index d2613c57504..7cacfe626a9 100644
--- a/src/vs/platform/search/common/search.ts
+++ b/src/vs/platform/search/common/search.ts
@@ -10,7 +10,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import * as paths from 'vs/base/common/paths';
import uri, { UriComponents } from 'vs/base/common/uri';
-import { PPromise, TPromise } from 'vs/base/common/winjs.base';
+import { TPromise } from 'vs/base/common/winjs.base';
import { IFilesConfiguration } from 'vs/platform/files/common/files';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
@@ -46,7 +46,7 @@ export interface ISearchHistoryService {
}
export interface ISearchResultProvider {
- search(query: ISearchQuery): PPromise;
+ search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise;
clearCache(cacheKey: string): TPromise;
}
diff --git a/src/vs/platform/telemetry/common/telemetryService.ts b/src/vs/platform/telemetry/common/telemetryService.ts
index dba27cde4b1..0b8470198a3 100644
--- a/src/vs/platform/telemetry/common/telemetryService.ts
+++ b/src/vs/platform/telemetry/common/telemetryService.ts
@@ -21,7 +21,6 @@ export interface ITelemetryServiceConfig {
appender: ITelemetryAppender;
commonProperties?: TPromise<{ [name: string]: any }>;
piiPaths?: string[];
- userOptIn?: boolean;
}
export class TelemetryService implements ITelemetryService {
@@ -46,7 +45,7 @@ export class TelemetryService implements ITelemetryService {
this._appender = config.appender;
this._commonProperties = config.commonProperties || TPromise.as({});
this._piiPaths = config.piiPaths || [];
- this._userOptIn = typeof config.userOptIn === 'undefined' ? true : config.userOptIn;
+ this._userOptIn = true;
// static cleanup pattern for: `file:///DANGEROUS/PATH/resources/app/Useful/Information`
this._cleanupPatterns = [/file:\/\/\/.*?\/resources\/app\//gi];
diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts
index 83ff1f5b7a8..8cd91f0803b 100644
--- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts
+++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts
@@ -14,8 +14,6 @@ import * as Errors from 'vs/base/common/errors';
import * as sinon from 'sinon';
import { getConfigurationValue } from 'vs/platform/configuration/common/configuration';
-const optInStatusEventName: string = 'optInStatus';
-
class TestTelemetryAppender implements ITelemetryAppender {
public events: any[];
@@ -719,29 +717,9 @@ suite('TelemetryService', () => {
}
}));
- test('Telemetry Service respects user opt-in settings', sinon.test(function () {
+ test('Telemetry Service sends events when enableTelemetry is on', sinon.test(function () {
let testAppender = new TestTelemetryAppender();
- let service = new TelemetryService({ userOptIn: false, appender: testAppender }, undefined);
-
- return service.publicLog('testEvent').then(() => {
- assert.equal(testAppender.getEventsCount(), 0);
- service.dispose();
- });
- }));
-
- test('Telemetry Service does not sent optInStatus when user opted out', sinon.test(function () {
- let testAppender = new TestTelemetryAppender();
- let service = new TelemetryService({ userOptIn: false, appender: testAppender }, undefined);
-
- return service.publicLog(optInStatusEventName, { optIn: false }).then(() => {
- assert.equal(testAppender.getEventsCount(), 0);
- service.dispose();
- });
- }));
-
- test('Telemetry Service sends events when enableTelemetry is on even user optin is on', sinon.test(function () {
- let testAppender = new TestTelemetryAppender();
- let service = new TelemetryService({ userOptIn: true, appender: testAppender }, undefined);
+ let service = new TelemetryService({ appender: testAppender }, undefined);
return service.publicLog('testEvent').then(() => {
assert.equal(testAppender.getEventsCount(), 1);
diff --git a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts
index c98eea4b962..013485d5e42 100644
--- a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts
+++ b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts
@@ -10,7 +10,7 @@ import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findI
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { IContextScopedWidget, getContextScopedWidget, createWidgetScopedContextKeyService, bindContextScopedWidget } from 'vs/platform/widget/common/contextScopedWidget';
import { IHistoryNavigationWidget } from 'vs/base/browser/history';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
export const HistoryNavigationWidgetContext = 'historyNavigationWidget';
@@ -53,7 +53,7 @@ export class ContextScopedFindInput extends FindInput {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'history.showPrevious',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(new ContextKeyDefinedExpr(HistoryNavigationWidgetContext), new ContextKeyEqualsExpr(HistoryNavigationEnablementContext, true)),
primary: KeyCode.UpArrow,
secondary: [KeyMod.Alt | KeyCode.UpArrow],
@@ -65,7 +65,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'history.showNext',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
when: new ContextKeyAndExpr([new ContextKeyDefinedExpr(HistoryNavigationWidgetContext), new ContextKeyEqualsExpr(HistoryNavigationEnablementContext, true)]),
primary: KeyCode.DownArrow,
secondary: [KeyMod.Alt | KeyCode.DownArrow],
diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts
index 39a413b09e4..4d2a8cc88d5 100644
--- a/src/vs/platform/workspace/common/workspace.ts
+++ b/src/vs/platform/workspace/common/workspace.ts
@@ -77,6 +77,15 @@ export interface IWorkspaceContextService {
isInsideWorkspace(resource: URI): boolean;
}
+export namespace IWorkspace {
+ export function isIWorkspace(thing: any): thing is IWorkspace {
+ return thing && typeof thing === 'object'
+ && typeof (thing as IWorkspace).id === 'string'
+ && typeof (thing as IWorkspace).name === 'string'
+ && Array.isArray((thing as IWorkspace).folders);
+ }
+}
+
export interface IWorkspace {
/**
@@ -118,6 +127,15 @@ export interface IWorkspaceFolderData {
readonly index: number;
}
+export namespace IWorkspaceFolder {
+ export function isIWorkspaceFolder(thing: any): thing is IWorkspaceFolder {
+ return thing && typeof thing === 'object'
+ && URI.isUri((thing as IWorkspaceFolder).uri)
+ && typeof (thing as IWorkspaceFolder).name === 'string'
+ && typeof (thing as IWorkspaceFolder).toResource === 'function';
+ }
+}
+
export interface IWorkspaceFolder extends IWorkspaceFolderData {
/**
diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts
index 607f418e181..ac726df3447 100644
--- a/src/vs/vscode.d.ts
+++ b/src/vs/vscode.d.ts
@@ -5500,6 +5500,11 @@ declare module 'vscode' {
*/
title: string;
+ /**
+ * Icon for the panel shown in UI.
+ */
+ iconPath?: Uri | { light: Uri; dark: Uri };
+
/**
* Webview belonging to the panel.
*/
diff --git a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts
index 7e3224c1de2..caffd57767b 100644
--- a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts
+++ b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts
@@ -5,14 +5,14 @@
'use strict';
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
-import { IDisposable, dispose } from 'vs/base/common/lifecycle';
+import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { values } from 'vs/base/common/map';
import URI, { UriComponents } from 'vs/base/common/uri';
-import { PPromise, TPromise } from 'vs/base/common/winjs.base';
-import { IFileMatch, ISearchComplete, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType, IRawFileMatch2, ISearchCompleteStats } from 'vs/platform/search/common/search';
+import { TPromise } from 'vs/base/common/winjs.base';
+import { IFileMatch, IRawFileMatch2, ISearchComplete, ISearchCompleteStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType } from 'vs/platform/search/common/search';
+import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { ExtHostContext, ExtHostSearchShape, IExtHostContext, MainContext, MainThreadSearchShape } from '../node/extHost.protocol';
-import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@extHostNamedCustomer(MainContext.MainThreadSearch)
export class MainThreadSearch implements MainThreadSearchShape {
@@ -97,10 +97,10 @@ class RemoteSearchProvider implements ISearchResultProvider, IDisposable {
dispose(this._registrations);
}
- search(query: ISearchQuery): PPromise {
+ search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise {
if (isFalsyOrEmpty(query.folderQueries)) {
- return PPromise.as(undefined);
+ return TPromise.as(undefined);
}
const folderQueriesForScheme = query.folderQueries.filter(fq => fq.folder.scheme === this._scheme);
@@ -115,9 +115,9 @@ class RemoteSearchProvider implements ISearchResultProvider, IDisposable {
let outer: TPromise;
- return new PPromise((resolve, reject, report) => {
+ return new TPromise((resolve, reject) => {
- const search = new SearchOperation(report);
+ const search = new SearchOperation(onProgress);
this._searches.set(search.id, search);
outer = query.type === QueryType.File
diff --git a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
index ccf129ce117..c25e31ae085 100644
--- a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
+++ b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
@@ -16,6 +16,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
private _proxy: ExtHostTerminalServiceShape;
private _toDispose: IDisposable[] = [];
private _terminalProcesses: { [id: number]: ITerminalProcessExtHostProxy } = {};
+ private _terminalOnDidWriteDataListeners: { [id: number]: IDisposable } = {};
+ private _terminalOnDidAcceptInputListeners: { [id: number]: IDisposable } = {};
constructor(
extHostContext: IExtHostContext,
@@ -114,9 +116,18 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
public $terminalRendererRegisterOnInputListener(terminalId: number): void {
const terminalInstance = this.terminalService.getInstanceFromId(terminalId);
- if (terminalInstance) {
- terminalInstance.addDisposable(terminalInstance.onRendererInput(data => this._onTerminalRendererInput(terminalId, data)));
+ if (!terminalInstance) {
+ return;
}
+
+ // Listener already registered
+ if (this._terminalOnDidAcceptInputListeners.hasOwnProperty(terminalId)) {
+ return;
+ }
+
+ // Register
+ this._terminalOnDidAcceptInputListeners[terminalId] = terminalInstance.onRendererInput(data => this._onTerminalRendererInput(terminalId, data));
+ terminalInstance.addDisposable(this._terminalOnDidAcceptInputListeners[terminalId]);
}
public $sendText(terminalId: number, text: string, addNewLine: boolean): void {
@@ -128,11 +139,20 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
public $registerOnDataListener(terminalId: number): void {
const terminalInstance = this.terminalService.getInstanceFromId(terminalId);
- if (terminalInstance) {
- terminalInstance.addDisposable(terminalInstance.onData(data => {
- this._onTerminalData(terminalId, data);
- }));
+ if (!terminalInstance) {
+ return;
}
+
+ // Listener already registered
+ if (this._terminalOnDidWriteDataListeners[terminalId]) {
+ return;
+ }
+
+ // Register
+ this._terminalOnDidWriteDataListeners[terminalId] = terminalInstance.onData(data => {
+ this._onTerminalData(terminalId, data);
+ });
+ terminalInstance.addDisposable(this._terminalOnDidWriteDataListeners[terminalId]);
}
private _onActiveTerminalChanged(terminalId: number | undefined): void {
diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts
index 8def9ec323a..9e36bedbf59 100644
--- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts
@@ -2,23 +2,24 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { IDisposable, dispose } from 'vs/base/common/lifecycle';
+import * as dom from 'vs/base/browser/dom';
+import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as map from 'vs/base/common/map';
import URI, { UriComponents } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { localize } from 'vs/nls';
-import { EditorViewColumn, viewColumnToEditorGroup, editorGroupToViewColumn } from 'vs/workbench/api/shared/editor';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle } from 'vs/workbench/api/node/extHost.protocol';
+import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/shared/editor';
import { WebviewEditor } from 'vs/workbench/parts/webview/electron-browser/webviewEditor';
import { WebviewEditorInput } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInput';
-import { IWebviewEditorService, WebviewInputOptions, WebviewReviver, ICreateWebViewShowOptions } from 'vs/workbench/parts/webview/electron-browser/webviewEditorService';
+import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions, WebviewReviver } from 'vs/workbench/parts/webview/electron-browser/webviewEditorService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
-import { extHostNamedCustomer } from './extHostCustomers';
import * as vscode from 'vscode';
+import { extHostNamedCustomer } from './extHostCustomers';
@extHostNamedCustomer(MainContext.MainThreadWebviews)
export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver {
@@ -29,6 +30,39 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
private static revivalPool = 0;
+ private static _styleElement?: HTMLStyleElement;
+
+ private static _icons = new Map();
+
+ private static updateStyleElement(
+ webview: WebviewEditorInput,
+ iconPath: { light: URI, dark: URI } | undefined
+ ) {
+ const id = webview.getId();
+ if (!this._styleElement) {
+ this._styleElement = dom.createStyleSheet();
+ this._styleElement.className = 'webview-icons';
+ }
+
+ if (!iconPath) {
+ this._icons.delete(id);
+ } else {
+ this._icons.set(id, iconPath);
+ }
+
+ const cssRules: string[] = [];
+ this._icons.forEach((value, key) => {
+ const webviewSelector = `.show-file-icons .webview-${key}-name-file-icon::before`;
+ if (URI.isUri(value)) {
+ cssRules.push(`${webviewSelector} { content: ""; background-image: url(${value.toString()}); }`);
+ } else {
+ cssRules.push(`${webviewSelector} { content: ""; background-image: url(${value.light.toString()}); }`);
+ cssRules.push(`.vs-dark ${webviewSelector} { content: ""; background-image: url(${value.dark.toString()}); }`);
+ }
+ });
+ this._styleElement.innerHTML = cssRules.join('\n');
+ }
+
private _toDispose: IDisposable[] = [];
private readonly _proxy: ExtHostWebviewsShape;
@@ -96,6 +130,11 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
webview.setName(value);
}
+ public $setIconPath(handle: WebviewPanelHandle, value: { light: UriComponents, dark: UriComponents } | undefined): void {
+ const webview = this.getWebview(handle);
+ MainThreadWebviews.updateStyleElement(webview, reviveWebviewIcon(value));
+ }
+
public $setHtml(handle: WebviewPanelHandle, value: string): void {
const webview = this.getWebview(handle);
webview.html = value;
@@ -185,9 +224,16 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
onDidClickLink: uri => this.onDidClickLink(handle, uri),
onMessage: message => this._proxy.$onMessage(handle, message),
onDispose: () => {
+ const cleanUp = () => {
+ const webview = this._webviews.get(handle);
+ if (webview) {
+ MainThreadWebviews.updateStyleElement(webview, undefined);
+ }
+ this._webviews.delete(handle);
+ };
this._proxy.$onDidDisposeWebviewPanel(handle).then(
- () => this._webviews.delete(handle),
- () => this._webviews.delete(handle));
+ cleanUp,
+ cleanUp);
}
};
}
@@ -297,3 +343,16 @@ function reviveWebviewOptions(options: WebviewInputOptions): WebviewInputOptions
localResourceRoots: Array.isArray(options.localResourceRoots) ? options.localResourceRoots.map(URI.revive) : undefined
};
}
+
+function reviveWebviewIcon(
+ value: { light: UriComponents, dark: UriComponents } | undefined
+): { light: URI, dark: URI } | undefined {
+ if (!value) {
+ return undefined;
+ }
+
+ return {
+ light: URI.revive(value.light),
+ dark: URI.revive(value.dark)
+ };
+}
\ No newline at end of file
diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts
index ed91294b6c5..4ca5751ecef 100644
--- a/src/vs/workbench/api/node/extHost.api.impl.ts
+++ b/src/vs/workbench/api/node/extHost.api.impl.ts
@@ -110,7 +110,7 @@ export function createApiFactory(
const extHostDocumentSaveParticipant = rpcProtocol.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(extHostLogService, extHostDocuments, rpcProtocol.getProxy(MainContext.MainThreadTextEditors)));
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(rpcProtocol, extHostDocumentsAndEditors));
const extHostCommands = rpcProtocol.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(rpcProtocol, extHostHeapService, extHostLogService));
- const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands));
+ const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands, extHostLogService));
rpcProtocol.set(ExtHostContext.ExtHostWorkspace, extHostWorkspace);
rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration);
const extHostDiagnostics = rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, new ExtHostDiagnostics(rpcProtocol));
diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts
index 44947586fd5..dcccdfd0bf9 100644
--- a/src/vs/workbench/api/node/extHost.protocol.ts
+++ b/src/vs/workbench/api/node/extHost.protocol.ts
@@ -430,6 +430,7 @@ export interface MainThreadWebviewsShape extends IDisposable {
$disposeWebview(handle: WebviewPanelHandle): void;
$reveal(handle: WebviewPanelHandle, viewColumn: EditorViewColumn | null, preserveFocus: boolean): void;
$setTitle(handle: WebviewPanelHandle, value: string): void;
+ $setIconPath(handle: WebviewPanelHandle, value: { light: UriComponents, dark: UriComponents } | undefined): void;
$setHtml(handle: WebviewPanelHandle, value: string): void;
$setOptions(handle: WebviewPanelHandle, options: vscode.WebviewOptions): void;
$postMessage(handle: WebviewPanelHandle, value: any): Thenable;
diff --git a/src/vs/workbench/api/node/extHostSearch.ts b/src/vs/workbench/api/node/extHostSearch.ts
index 35f121e588c..e7bcb39550d 100644
--- a/src/vs/workbench/api/node/extHostSearch.ts
+++ b/src/vs/workbench/api/node/extHostSearch.ts
@@ -10,7 +10,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
import * as glob from 'vs/base/common/glob';
import * as resources from 'vs/base/common/resources';
import URI, { UriComponents } from 'vs/base/common/uri';
-import { PPromise, TPromise } from 'vs/base/common/winjs.base';
+import { TPromise } from 'vs/base/common/winjs.base';
import * as extfs from 'vs/base/node/extfs';
import { IFileMatch, IFolderQuery, IPatternInfo, IRawSearchQuery, ISearchCompleteStats, ISearchQuery } from 'vs/platform/search/common/search';
import * as vscode from 'vscode';
@@ -58,12 +58,9 @@ export class ExtHostSearch implements ExtHostSearchShape {
}
const query = reviveQuery(rawQuery);
- return this._fileSearchManager.fileSearch(query, provider).then(
- null,
- null,
- progress => {
- this._proxy.$handleFileMatch(handle, session, progress.map(p => p.resource));
- });
+ return this._fileSearchManager.fileSearch(query, provider, progress => {
+ this._proxy.$handleFileMatch(handle, session, progress.map(p => p.resource));
+ });
}
$clearCache(handle: number, cacheKey: string): TPromise {
@@ -84,12 +81,7 @@ export class ExtHostSearch implements ExtHostSearchShape {
const query = reviveQuery(rawQuery);
const engine = new TextSearchEngine(pattern, query, provider, this._extfs);
- return engine.search().then(
- null,
- null,
- progress => {
- this._proxy.$handleTextMatch(handle, session, progress);
- });
+ return engine.search(progress => this._proxy.$handleTextMatch(handle, session, progress));
}
}
@@ -380,11 +372,11 @@ class TextSearchEngine {
this.activeCancellationTokens = new Set();
}
- public search(): PPromise<{ limitHit: boolean }, IFileMatch[]> {
+ public search(onProgress: (matches: IFileMatch[]) => void): TPromise<{ limitHit: boolean }> {
const folderQueries = this.config.folderQueries;
- return new PPromise<{ limitHit: boolean }, IFileMatch[]>((resolve, reject, _onResult) => {
- this.collector = new TextSearchResultsCollector(_onResult);
+ return new TPromise<{ limitHit: boolean }>((resolve, reject) => {
+ this.collector = new TextSearchResultsCollector(onProgress);
const onResult = (match: vscode.TextSearchResult, folderIdx: number) => {
if (this.isCanceled) {
@@ -403,8 +395,8 @@ class TextSearchEngine {
};
// For each root folder
- PPromise.join(folderQueries.map((fq, i) => {
- return this.searchInFolder(fq).then(null, null, r => onResult(r, i));
+ TPromise.join(folderQueries.map((fq, i) => {
+ return this.searchInFolder(fq, r => onResult(r, i));
})).then(() => {
this.collector.flush();
resolve({ limitHit: this.isLimitHit });
@@ -418,9 +410,9 @@ class TextSearchEngine {
});
}
- private searchInFolder(folderQuery: IFolderQuery): PPromise {
+ private searchInFolder(folderQuery: IFolderQuery, onResult: (result: vscode.TextSearchResult) => void): TPromise {
let cancellation = new CancellationTokenSource();
- return new PPromise((resolve, reject, onResult) => {
+ return new TPromise((resolve, reject) => {
const queryTester = new QueryGlobTester(this.config, folderQuery);
const testingPs = [];
@@ -532,10 +524,10 @@ class FileSearchEngine {
this.activeCancellationTokens = new Set();
}
- public search(): PPromise {
+ public search(_onResult: (match: IInternalFileMatch) => void): TPromise {
const folderQueries = this.config.folderQueries;
- return new PPromise((resolve, reject, _onResult) => {
+ return new TPromise((resolve, reject) => {
const onResult = (match: IInternalFileMatch) => {
this.resultCount++;
_onResult(match);
@@ -562,8 +554,8 @@ class FileSearchEngine {
}
// For each root folder
- PPromise.join(folderQueries.map(fq => {
- return this.searchInFolder(fq).then(null, null, onResult);
+ TPromise.join(folderQueries.map(fq => {
+ return this.searchInFolder(fq, onResult);
})).then(cacheKeys => {
resolve({ limitHit: this.isLimitHit, cacheKeys });
}, (errs: Error[]) => {
@@ -576,9 +568,9 @@ class FileSearchEngine {
});
}
- private searchInFolder(fq: IFolderQuery): PPromise {
+ private searchInFolder(fq: IFolderQuery, onResult: (match: IInternalFileMatch) => void): TPromise {
let cancellation = new CancellationTokenSource();
- return new PPromise((resolve, reject, onResult) => {
+ return new TPromise((resolve, reject) => {
const options = this.getSearchOptionsForFolder(fq);
const tree = this.initDirectoryTree();
@@ -748,12 +740,16 @@ class FileSearchManager {
private readonly expandedCacheKeys = new Map();
- fileSearch(config: ISearchQuery, provider: vscode.SearchProvider): PPromise {
- let searchP: PPromise;
- return new PPromise((c, e, p) => {
+ fileSearch(config: ISearchQuery, provider: vscode.SearchProvider, onResult: (matches: IFileMatch[]) => void): TPromise {
+ let searchP: TPromise;
+ return new TPromise((c, e) => {
const engine = new FileSearchEngine(config, provider);
- searchP = this.doSearch(engine, FileSearchManager.BATCH_SIZE).then(
+ const onInternalResult = (progress: IInternalFileMatch[]) => {
+ onResult(progress.map(m => this.rawMatchToSearchItem(m)));
+ };
+
+ searchP = this.doSearch(engine, FileSearchManager.BATCH_SIZE, onInternalResult).then(
result => {
if (config.cacheKey) {
this.expandedCacheKeys.set(config.cacheKey, result.cacheKeys);
@@ -763,10 +759,7 @@ class FileSearchManager {
limitHit: result.limitHit
});
},
- e,
- progress => {
- p(progress.map(m => this.rawMatchToSearchItem(m)));
- });
+ e);
}, () => {
if (searchP) {
searchP.cancel();
@@ -789,29 +782,31 @@ class FileSearchManager {
};
}
- private doSearch(engine: FileSearchEngine, batchSize: number): PPromise {
- return new PPromise((c, e, p) => {
+ private doSearch(engine: FileSearchEngine, batchSize: number, onResultBatch: (matches: IInternalFileMatch[]) => void): TPromise {
+ return new TPromise((c, e) => {
+ const _onResult = match => {
+ if (match) {
+ batch.push(match);
+ if (batchSize > 0 && batch.length >= batchSize) {
+ onResultBatch(batch);
+ batch = [];
+ }
+ }
+ };
+
let batch: IInternalFileMatch[] = [];
- engine.search().then(result => {
+ engine.search(_onResult).then(result => {
if (batch.length) {
- p(batch);
+ onResultBatch(batch);
}
c(result);
}, error => {
if (batch.length) {
- p(batch);
+ onResultBatch(batch);
}
e(error);
- }, match => {
- if (match) {
- batch.push(match);
- if (batchSize > 0 && batch.length >= batchSize) {
- p(batch);
- batch = [];
- }
- }
});
}, () => {
engine.cancel();
diff --git a/src/vs/workbench/api/node/extHostTreeViews.ts b/src/vs/workbench/api/node/extHostTreeViews.ts
index a63e56f9972..811fc4b464b 100644
--- a/src/vs/workbench/api/node/extHostTreeViews.ts
+++ b/src/vs/workbench/api/node/extHostTreeViews.ts
@@ -18,6 +18,7 @@ import { asWinJsPromise } from 'vs/base/common/async';
import { TreeItemCollapsibleState, ThemeIcon } from 'vs/workbench/api/node/extHostTypes';
import { isUndefinedOrNull } from 'vs/base/common/types';
import { equals } from 'vs/base/common/arrays';
+import { ILogService } from 'vs/platform/log/common/log';
type TreeItemHandle = string;
@@ -27,7 +28,8 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
constructor(
private _proxy: MainThreadTreeViewsShape,
- private commands: ExtHostCommands
+ private commands: ExtHostCommands,
+ private logService: ILogService
) {
commands.registerArgumentProcessor({
processArgument: arg => {
@@ -99,7 +101,7 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
}
private createExtHostTreeViewer(id: string, dataProvider: vscode.TreeDataProvider): ExtHostTreeView {
- const treeView = new ExtHostTreeView(id, dataProvider, this._proxy, this.commands.converter);
+ const treeView = new ExtHostTreeView(id, dataProvider, this._proxy, this.commands.converter, this.logService);
this.treeViews.set(id, treeView);
return treeView;
}
@@ -145,7 +147,7 @@ class ExtHostTreeView extends Disposable {
private refreshPromise: TPromise = TPromise.as(null);
- constructor(private viewId: string, private dataProvider: vscode.TreeDataProvider, private proxy: MainThreadTreeViewsShape, private commands: CommandsConverter) {
+ constructor(private viewId: string, private dataProvider: vscode.TreeDataProvider, private proxy: MainThreadTreeViewsShape, private commands: CommandsConverter, private logService: ILogService) {
super();
this.proxy.$registerTreeViewDataProvider(viewId);
if (this.dataProvider.onDidChangeTreeData) {
@@ -192,7 +194,7 @@ class ExtHostTreeView extends Disposable {
return this.refreshPromise
.then(() => this.resolveUnknownParentChain(element))
.then(parentChain => this.resolveTreeNode(element, parentChain[parentChain.length - 1])
- .then(treeNode => this.proxy.$reveal(this.viewId, treeNode.item, parentChain.map(p => p.item), { select, focus })));
+ .then(treeNode => this.proxy.$reveal(this.viewId, treeNode.item, parentChain.map(p => p.item), { select, focus })), error => this.logService.error(error));
}
setExpanded(treeItemHandle: TreeItemHandle, expanded: boolean): void {
diff --git a/src/vs/workbench/api/node/extHostWebview.ts b/src/vs/workbench/api/node/extHostWebview.ts
index 0ad6b97fa30..78fb98240ea 100644
--- a/src/vs/workbench/api/node/extHostWebview.ts
+++ b/src/vs/workbench/api/node/extHostWebview.ts
@@ -3,14 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { MainContext, MainThreadWebviewsShape, IMainContext, ExtHostWebviewsShape, WebviewPanelHandle, WebviewPanelViewState } from './extHost.protocol';
-import * as vscode from 'vscode';
-import { Event, Emitter } from 'vs/base/common/event';
+import { Emitter, Event } from 'vs/base/common/event';
+import URI from 'vs/base/common/uri';
+import { TPromise } from 'vs/base/common/winjs.base';
import * as typeConverters from 'vs/workbench/api/node/extHostTypeConverters';
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
-import { TPromise } from 'vs/base/common/winjs.base';
+import * as vscode from 'vscode';
+import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewState } from './extHost.protocol';
import { Disposable } from './extHostTypes';
-import URI from 'vs/base/common/uri';
+
+
+type IconPath = URI | { light: URI, dark: URI };
export class ExtHostWebview implements vscode.Webview {
private readonly _handle: WebviewPanelHandle;
@@ -78,6 +81,7 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel {
private readonly _proxy: MainThreadWebviewsShape;
private readonly _viewType: string;
private _title: string;
+ private _iconPath: IconPath;
private readonly _options: vscode.WebviewPanelOptions;
private readonly _webview: ExtHostWebview;
@@ -150,6 +154,20 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel {
}
}
+ get iconPath(): IconPath | undefined {
+ this.assertNotDisposed();
+ return this._iconPath;
+ }
+
+ set iconPath(value: IconPath | undefined) {
+ this.assertNotDisposed();
+ if (this._iconPath !== value) {
+ this._iconPath = value;
+
+ this._proxy.$setIconPath(this._handle, URI.isUri(value) ? { light: value, dark: value } : value);
+ }
+ }
+
get options() {
return this._options;
}
diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts
index 35768b3f5fa..2de5aa211ec 100644
--- a/src/vs/workbench/browser/labels.ts
+++ b/src/vs/workbench/browser/labels.ts
@@ -183,6 +183,7 @@ export class ResourceLabel extends IconLabel {
title: '',
italic: this.options && this.options.italic,
matches: this.options && this.options.matches,
+ extraClasses: []
};
const resource = this.label.resource;
diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts
index ac7b2f27130..83f309f828b 100644
--- a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts
+++ b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts
@@ -136,7 +136,7 @@ Registry.as(Extensions.Configuration).registerConfigurat
default: 'on',
enum: ['on', 'off', 'last'],
enumDescriptions: [
- localize('symbolpath.on', "Show all symbols the breadcrumbs view."),
+ localize('symbolpath.on', "Show all symbols in the breadcrumbs view."),
localize('symbolpath.off', "Do not show symbols in the breadcrumbs view."),
localize('symbolpath.last', "Only show the current symbol in the breadcrumbs view."),
]
diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
index c8a2110bfd2..14ab5ecc5b8 100644
--- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
+++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
@@ -23,7 +23,7 @@ import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from '
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { FileKind, IFileService } from 'vs/platform/files/common/files';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
-import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
+import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { attachBreadcrumbsStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -76,12 +76,12 @@ class Item extends BreadcrumbsItem {
let label = this._instantiationService.createInstance(FileLabel, container, {});
label.setFile(this.element.uri, {
hidePath: true,
- fileKind: this.element.isFile ? FileKind.FILE : FileKind.FOLDER,
- hideIcon: !this.element.isFile || !this.options.showFileIcons,
- fileDecorations: { colors: this.options.showDecorationColors, badges: false }
+ hideIcon: this.element.kind === FileKind.FOLDER || !this.options.showFileIcons,
+ fileKind: this.element.kind,
+ fileDecorations: { colors: this.options.showDecorationColors, badges: false },
});
+ dom.addClass(container, FileKind[this.element.kind].toLowerCase());
this._disposables.push(label);
- dom.toggleClass(container, 'file', this.element.isFile);
} else if (this.element instanceof OutlineModel) {
// has outline element but not in one
@@ -105,7 +105,7 @@ class Item extends BreadcrumbsItem {
}
let label = new IconLabel(container);
let title = this.element.symbol.name.replace(/\r|\n|\r\n/g, '\u23CE');
- label.setValue(title, undefined, { title });
+ label.setValue(title);
this._disposables.push(label);
}
}
@@ -323,7 +323,7 @@ export class BreadcrumbsControl {
private _revealInEditor(event: IBreadcrumbsItemEvent, data: any): void {
if (data instanceof FileElement) {
- if (data.isFile) {
+ if (data.kind === FileKind.FILE) {
// open file in editor
this._editorService.openEditor({ resource: data.uri });
} else {
@@ -373,7 +373,7 @@ CommandsRegistry.registerCommand('breadcrumbs.toggle', accessor => {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focus',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT,
when: BreadcrumbsControl.CK_BreadcrumbsVisible,
handler(accessor) {
@@ -385,7 +385,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focusNext',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.RightArrow,
secondary: [KeyMod.Shift | KeyCode.RightArrow],
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive),
@@ -397,7 +397,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focusPrevious',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.LeftArrow,
secondary: [KeyMod.Shift | KeyCode.LeftArrow],
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive),
@@ -409,7 +409,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.selectFocused',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.Enter,
secondary: [KeyCode.DownArrow],
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive),
@@ -422,7 +422,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.revealFocused',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.Shift | KeyCode.Enter,
secondary: [KeyCode.Space],
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive),
@@ -435,7 +435,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.selectEditor',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive),
@@ -449,7 +449,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.pickFromTree',
- weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
+ weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.Tab,
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive, WorkbenchListFocusContextKey),
handler(accessor) {
diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
index f29efc47db1..40d9babb573 100644
--- a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
+++ b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
@@ -18,22 +18,23 @@ import URI from 'vs/base/common/uri';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IPosition } from 'vs/editor/common/core/position';
import { DocumentSymbolProviderRegistry } from 'vs/editor/common/modes';
-import { OutlineElement, OutlineGroup, OutlineModel } from 'vs/editor/contrib/documentSymbols/outlineModel';
+import { OutlineElement, OutlineGroup, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel';
import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs';
+import { FileKind } from 'vs/platform/files/common/files';
export class FileElement {
constructor(
readonly uri: URI,
- readonly isFile: boolean
+ readonly kind: FileKind
) { }
}
export type BreadcrumbElement = FileElement | OutlineModel | OutlineGroup | OutlineElement;
-type FileInfo = { path: FileElement[], folder: IWorkspaceFolder, showFolder: boolean };
+type FileInfo = { path: FileElement[], folder: IWorkspaceFolder };
export class EditorBreadcrumbsModel {
@@ -101,14 +102,12 @@ export class EditorBreadcrumbsModel {
if (uri.scheme === Schemas.untitled) {
return {
- showFolder: false,
folder: undefined,
path: []
};
}
let info: FileInfo = {
- showFolder: workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE,
folder: workspaceService.getWorkspaceFolder(uri),
path: []
};
@@ -117,9 +116,13 @@ export class EditorBreadcrumbsModel {
if (info.folder && isEqual(info.folder.uri, uri)) {
break;
}
- info.path.unshift(new FileElement(uri, info.path.length === 0));
+ info.path.unshift(new FileElement(uri, info.path.length === 0 ? FileKind.FILE : FileKind.FOLDER));
uri = uri.with({ path: paths.dirname(uri.path) });
}
+
+ if (info.folder && workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
+ info.path.unshift(new FileElement(info.folder.uri, FileKind.ROOT_FOLDER));
+ }
return info;
}
@@ -163,18 +166,23 @@ export class EditorBreadcrumbsModel {
});
OutlineModel.create(buffer, source.token).then(model => {
+ if (TreeElement.empty(model)) {
+ // empty -> no outline elements
+ this._updateOutlineElements([]);
- // copy the model
- model = model.adopt();
+ } else {
+ // copy the model
+ model = model.adopt();
- this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
- this._outlineDisposables.push(this._editor.onDidChangeCursorPosition(_ => {
- timeout.cancelAndSet(() => {
- if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId()) {
- this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
- }
- }, 150);
- }));
+ this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
+ this._outlineDisposables.push(this._editor.onDidChangeCursorPosition(_ => {
+ timeout.cancelAndSet(() => {
+ if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId()) {
+ this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
+ }
+ }, 150);
+ }));
+ }
}).catch(err => {
this._updateOutlineElements([]);
onUnexpectedError(err);
diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
index 5a49481c2ec..c29f3e10307 100644
--- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
+++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
@@ -26,6 +26,7 @@ import { BreadcrumbElement, FileElement } from 'vs/workbench/browser/parts/edito
import { onUnexpectedError } from 'vs/base/common/errors';
import { breadcrumbsPickerBackground } from 'vs/platform/theme/common/colorRegistry';
import { FuzzyScore, createMatches, fuzzyScore } from 'vs/base/common/filters';
+import { IWorkspaceContextService, IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
export function createBreadcrumbsPicker(instantiationService: IInstantiationService, parent: HTMLElement, element: BreadcrumbElement): BreadcrumbsPicker {
let ctor: IConstructorSignature1 = element instanceof FileElement ? BreadcrumbsFilePicker : BreadcrumbsOutlinePicker;
@@ -102,7 +103,7 @@ export abstract class BreadcrumbsPicker {
this._tree.setInput(actualInput).then(() => {
let selection = this._getInitialSelection(this._tree, input);
if (selection) {
- this._tree.reveal(selection).then(() => {
+ this._tree.reveal(selection, .5).then(() => {
this._tree.setSelection([selection], this._tree);
this._tree.setFocus(selection);
this._tree.domFocus();
@@ -136,39 +137,61 @@ export abstract class BreadcrumbsPicker {
export class FileDataSource implements IDataSource {
- private readonly _parents = new WeakMap();
+ private readonly _parents = new WeakMap