Merge branch 'master' into joh/extpack

This commit is contained in:
Johannes Rieken 2018-08-16 10:07:18 +02:00
commit 64b82b2a35
112 changed files with 1000 additions and 1010 deletions

View file

@ -25,5 +25,7 @@
'2018-06-25 18:00, US/Pacific': 'endgame',
'2018-07-05 12:00, US/Pacific': 'development', # 1.25.0 released
'2018-07-30 18:00, US/Pacific': 'endgame',
'2018-08-13 12:00, US/Pacific': 'development' # 1.26.0 released
'2018-08-13 12:00, US/Pacific': 'development', # 1.26.0 released
'2018-08-27 18:00, US/Pacific': 'endgame',
# '2018-09-05 12:00, US/Pacific': 'development', # 1.27.0 released
}

View file

@ -9,7 +9,7 @@ import * as jschardet from 'jschardet';
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
function detectEncodingByBOM(buffer: NodeBuffer): string | null {
function detectEncodingByBOM(buffer: Buffer): string | null {
if (!buffer || buffer.length < 2) {
return null;
}

View file

@ -3,7 +3,7 @@ declare module 'jschardet' {
encoding: string,
confidence: number
}
export function detect(buffer: NodeBuffer): IDetectedMap;
export function detect(buffer: Buffer): IDetectedMap;
export const Constants: {
MINIMUM_THRESHOLD: number,

View file

@ -23,7 +23,7 @@ export class LineDecoder {
this.remaining = null;
}
public write(buffer: NodeBuffer): string[] {
public write(buffer: Buffer): string[] {
var result: string[] = [];
var value = this.remaining
? this.remaining + this.stringDecoder.write(buffer)

View file

@ -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/PowerShell/EditorSyntax/commit/472c9447da4e3160bef211d5e1a0c2dee3cce497",
"version": "https://github.com/PowerShell/EditorSyntax/commit/6f5438611c54922ea94c81532a2dcfee72190039",
"name": "PowerShell",
"scopeName": "source.powershell",
"patterns": [
@ -71,17 +71,7 @@
},
{
"begin": "(?<!')'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.powershell"
}
},
"end": "'(?!')",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.powershell"
}
},
"name": "string.quoted.single.powershell",
"patterns": [
{
@ -147,7 +137,7 @@
"begin": "(\\$)(\\()",
"beginCaptures": {
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.group.begin.powershell"
@ -180,20 +170,8 @@
"name": "keyword.control.powershell"
},
{
"begin": "(?<!\\w)(--%)(?!\\w)",
"beginCaptures": {
"1": {
"name": "keyword.control.powershell"
}
},
"end": "$",
"patterns": [
{
"match": ".+",
"name": "string.unquoted.powershell"
}
],
"comment": "This should be moved to the repository at some point."
"match": "(?<!\\w)(--%)(?!\\w)",
"name": "keyword.control.powershell"
},
{
"comment": "This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.",
@ -242,7 +220,7 @@
},
{
"match": "\\|{2}|&{2}|;",
"name": "punctuation.terminator.statement.powershell"
"name": "keyword.other.statement-separator.powershell"
},
{
"match": "&|(?<!\\w)\\.(?= )|`|,|\\|",
@ -262,7 +240,7 @@
"name": "punctuation.definition.comment.powershell"
}
},
"end": "$\\n?",
"end": "$",
"name": "comment.line.powershell",
"patterns": [
{
@ -348,17 +326,7 @@
},
{
"begin": "(?<!')'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.powershell"
}
},
"end": "'(?!')",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.powershell"
}
},
"name": "string.quoted.single.powershell",
"patterns": [
{
@ -411,7 +379,7 @@
"name": "keyword.operator.documentation.powershell"
}
},
"match": "^(?i:(?:\\s*|#)+(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
"match": "(?i:\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
"name": "comment.documentation.embedded.powershell"
},
{
@ -496,7 +464,7 @@
"begin": "(\\$)(\\()",
"beginCaptures": {
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.group.begin.powershell"
@ -649,11 +617,11 @@
"patterns": [
{
"captures": {
"0": {
"name": "constant.language.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "constant.language.powershell"
}
},
"comment": "These are special constants.",
@ -661,14 +629,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.variable.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "These are the other built-in constants.",
@ -676,14 +644,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.automatic.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.",
@ -691,14 +659,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "variable.language.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "Style preference variables as language variables so that they stand out.",
@ -706,28 +674,25 @@
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.braces.begin.powershell"
@ -735,39 +700,39 @@
"3": {
"name": "storage.modifier.scope.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "punctuation.section.braces.end.powershell"
},
"6": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$|@)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.braces.begin.powershell"
@ -775,11 +740,14 @@
"3": {
"name": "support.variable.drive.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "punctuation.section.braces.end.powershell"
},
"6": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$)(\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
@ -827,11 +795,11 @@
"patterns": [
{
"captures": {
"0": {
"name": "constant.language.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "constant.language.powershell"
}
},
"comment": "These are special constants.",
@ -839,14 +807,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.variable.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "These are the other built-in constants.",
@ -854,14 +822,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.automatic.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "Automatic variables are not constants, but they are read-only...",
@ -869,14 +837,14 @@
},
{
"captures": {
"0": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "variable.language.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
},
"3": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"comment": "Style preference variables as language variables so that they stand out.",
@ -884,65 +852,62 @@
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "keyword.other.powershell"
},
"5": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.member.powershell"
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))"
},
{
"captures": {
"0": {
"name": "variable.other.readwrite.powershell"
},
"1": {
"name": "punctuation.definition.variable.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.braces.begin"
@ -950,6 +915,9 @@
"3": {
"name": "support.variable.drive.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "punctuation.section.braces.end"
}
@ -1004,17 +972,7 @@
},
"doubleQuotedString": {
"begin": "(?<!(?<!`)\")\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.powershell"
}
},
"end": "\"(?!\")",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.powershell"
}
},
"name": "string.quoted.double.powershell",
"patterns": [
{

View file

@ -155,13 +155,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -287,13 +287,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -386,13 +386,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -441,13 +441,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -463,13 +463,13 @@
},
{
"c": ".IsInRole",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell variable.other.readwrite.powershell variable.other.member.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell entity.name.function.invocation.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"hc_black": "entity.name.function: #DCDCAA"
}
},
{
@ -649,18 +649,7 @@
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "Failed to determine if the current user has elevated privileges. The error was: '{0}'.",
"c": "\"Failed to determine if the current user has elevated privileges. The error was: '{0}'.\"",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -670,17 +659,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell",
@ -716,13 +694,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell support.constant.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1013,13 +991,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1090,13 +1068,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1167,7 +1145,7 @@
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -1178,13 +1156,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1199,7 +1177,7 @@
}
},
{
"c": " 2>&1 & set",
"c": " 2>&1 & set\"",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -1209,17 +1187,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.powershell meta.scriptblock.powershell punctuation.section.group.end.powershell",
@ -1299,13 +1266,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1353,18 +1320,7 @@
}
},
{
"c": "'",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "^([^=]+)=(.*)",
"c": "'^([^=]+)=(.*)'",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.single.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -1374,17 +1330,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell punctuation.section.group.end.powershell",
@ -1486,13 +1431,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1563,13 +1508,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1727,18 +1672,7 @@
}
},
{
"c": "'",
"t": "source.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "Initializing Azure PowerShell environment...",
"c": "'Initializing Azure PowerShell environment...'",
"t": "source.powershell string.quoted.single.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -1748,26 +1682,15 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ";",
"t": "source.powershell punctuation.terminator.statement.powershell",
"t": "source.powershell keyword.other.statement-separator.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -1947,18 +1870,7 @@
}
},
{
"c": "'",
"t": "source.powershell meta.scriptblock.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "Please launch command under administrator account. It is needed for environment setting up and unit test.",
"c": "'Please launch command under administrator account. It is needed for environment setting up and unit test.'",
"t": "source.powershell meta.scriptblock.powershell string.quoted.single.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -1968,17 +1880,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.powershell meta.scriptblock.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.powershell meta.scriptblock.powershell",
@ -2014,13 +1915,13 @@
},
{
"c": ";",
"t": "source.powershell meta.scriptblock.powershell punctuation.terminator.statement.powershell",
"t": "source.powershell meta.scriptblock.powershell keyword.other.statement-separator.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2036,18 +1937,18 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
"c": "env:",
"t": "source.powershell variable.other.readwrite.powershell support.variable.drive.powershell",
"t": "source.powershell support.variable.drive.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
@ -2168,18 +2069,18 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
"c": "env:",
"t": "source.powershell variable.other.readwrite.powershell support.variable.drive.powershell",
"t": "source.powershell support.variable.drive.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
@ -2201,13 +2102,13 @@
},
{
"c": ";",
"t": "source.powershell punctuation.terminator.statement.powershell",
"t": "source.powershell keyword.other.statement-separator.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2289,7 +2190,7 @@
},
{
"c": "\"",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -2300,18 +2201,18 @@
},
{
"c": "$",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
"c": "env:",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell variable.other.readwrite.powershell support.variable.drive.powershell",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell support.variable.drive.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
@ -2332,7 +2233,7 @@
}
},
{
"c": "\\Microsoft Visual Studio 12.0",
"c": "\\Microsoft Visual Studio 12.0\"",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -2342,17 +2243,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.powershell interpolated.simple.source.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.powershell punctuation.section.group.end.powershell",
@ -2399,13 +2289,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2431,18 +2321,7 @@
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "12.0",
"c": "\"12.0\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -2452,17 +2331,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "}",
"t": "source.powershell meta.scriptblock.powershell punctuation.section.braces.end.powershell",
@ -2531,13 +2399,13 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2563,18 +2431,7 @@
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "11.0",
"c": "\"11.0\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -2584,17 +2441,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "}",
"t": "source.powershell meta.scriptblock.powershell punctuation.section.braces.end.powershell",
@ -2608,13 +2454,13 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2662,18 +2508,7 @@
}
},
{
"c": "'",
"t": "source.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "\"{0}\\Microsoft Visual Studio {1}\\VC\\vcvarsall.bat\" x64",
"c": "'\"{0}\\Microsoft Visual Studio {1}\\VC\\vcvarsall.bat\" x64'",
"t": "source.powershell string.quoted.single.powershell",
"r": {
"dark_plus": "string: #CE9178",
@ -2683,17 +2518,6 @@
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.powershell",
@ -2729,18 +2553,18 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
"c": "env:",
"t": "source.powershell variable.other.readwrite.powershell support.variable.drive.powershell",
"t": "source.powershell support.variable.drive.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
@ -2784,13 +2608,13 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2806,13 +2630,13 @@
},
{
"c": ";",
"t": "source.powershell punctuation.terminator.statement.powershell",
"t": "source.powershell keyword.other.statement-separator.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2861,13 +2685,13 @@
},
{
"c": "$",
"t": "source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell",
"t": "source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
},
{
@ -2883,13 +2707,13 @@
},
{
"c": ";",
"t": "source.powershell punctuation.terminator.statement.powershell",
"t": "source.powershell keyword.other.statement-separator.powershell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
"dark_plus": "keyword: #569CD6",
"light_plus": "keyword: #0000FF",
"dark_vs": "keyword: #569CD6",
"light_vs": "keyword: #0000FF",
"hc_black": "keyword: #569CD6"
}
}
]

View file

@ -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/fb56c6a98d684e30bed1b0f9647e85741a48f914",
"version": "https://github.com/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5",
"name": "MagicPython",
"scopeName": "source.python",
"patterns": [
@ -97,8 +97,7 @@
},
"docstring-statement": {
"begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
"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]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
"end": "(?<=\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\")",
"patterns": [
{
"include": "#docstring"
@ -165,7 +164,7 @@
{
"name": "string.quoted.docstring.single.python",
"begin": "(\\'|\\\")",
"end": "(\\1)|(\\n)",
"end": "(\\1)|((?<!\\\\)\\n)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin.python"
@ -191,7 +190,7 @@
{
"name": "string.quoted.docstring.raw.single.python",
"begin": "([rR])(\\'|\\\")",
"end": "(\\2)|(\\n)",
"end": "(\\2)|((?<!\\\\)\\n)",
"beginCaptures": {
"1": {
"name": "storage.type.string.python"
@ -848,45 +847,40 @@
"match": "\\\\$"
},
"string-formatting": {
"name": "meta.format.percent.python",
"match": "(?x)\n (\n % (\\([\\w\\s]*\\))?\n [-+#0 ]*\n (\\d+|\\*)? (\\.(\\d+|\\*))?\n ([hlL])?\n [diouxXeEfFgGcrsa%]\n )\n",
"captures": {
"1": {
"name": "constant.character.format.placeholder.other.python"
}
}
"name": "constant.character.format.placeholder.other.python",
"match": "(?x)\n % (\\([\\w\\s]*\\))?\n [-+#0 ]*\n (\\d+|\\*)? (\\.(\\d+|\\*))?\n ([hlL])?\n [diouxXeEfFgGcrsa%]\n"
},
"string-brace-formatting": {
"patterns": [
{
"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",
"name": "constant.character.format.placeholder.other.python",
"match": "(?x)\n (?:\n {{ | }}\n | (?:\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n",
"captures": {
"1": {
"name": "constant.character.format.placeholder.other.python"
},
"3": {
"2": {
"name": "storage.type.format.python"
},
"4": {
"3": {
"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"
"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"
},
"3": {
"name": "storage.type.format.python"
},
"4": {
"name": "storage.type.format.python"
}
}
},
"patterns": [
{
"match": "(?x) \\{ [^'\"}\\n]*? \\} (?=.*?\\})\n"
}
]
}
]
},
@ -4543,7 +4537,7 @@
},
"string-quoted-single-line": {
"name": "string.quoted.single.python",
"begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))",
"begin": "(\\b[rR](?=[uU]))?([uU])?((['\"]))",
"end": "(\\3)|((?<!\\\\)\\n)",
"beginCaptures": {
"1": {
@ -4717,7 +4711,7 @@
},
"string-quoted-multi-line": {
"name": "string.quoted.multi.python",
"begin": "(?:\\b([rR])(?=[uU]))?([uU])?('''|\"\"\")",
"begin": "(\\b[rR](?=[uU]))?([uU])?('''|\"\"\")",
"end": "(\\3)",
"beginCaptures": {
"1": {

View file

@ -15,7 +15,7 @@
"dependencies": {
"vscode-extension-telemetry": "0.0.18",
"vscode-nls": "^3.2.4",
"vscode-ripgrep": "^1.0.1"
"vscode-ripgrep": "1.1.0"
},
"devDependencies": {
"@types/node": "8.0.33",

View file

@ -366,6 +366,7 @@ function getRgArgs(query: vscode.TextSearchQuery, options: vscode.TextSearchOpti
}
args.push('--no-config');
args.push('--no-ignore-global');
// Folder to search
args.push('--');

View file

@ -1549,9 +1549,9 @@ vscode-nls@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.4.tgz#2166b4183c8aea884d20727f5449e62be69fd398"
vscode-ripgrep@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.0.1.tgz#eff2f2b2a49921ac0acd3ff8dfecaaeebf0184cf"
vscode-ripgrep@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.1.0.tgz#93c1e39d88342ee1b15530a12898ce930d511948"
vscode@^1.1.17:
version "1.1.17"

View file

@ -27,6 +27,8 @@
"storage.type.boolean.go",
"storage.type.string.go",
"storage.type.uintptr.go",
"storage.type.error.go",
"storage.type.rune.go",
"storage.type.cs",
"storage.type.generic.cs",
"storage.type.modifier.cs",

View file

@ -27,6 +27,8 @@
"storage.type.boolean.go",
"storage.type.string.go",
"storage.type.uintptr.go",
"storage.type.error.go",
"storage.type.rune.go",
"storage.type.cs",
"storage.type.generic.cs",
"storage.type.modifier.cs",

View file

@ -42,10 +42,7 @@
"onCommand:typescript.goToProjectConfig",
"onCommand:typescript.openTsServerLog",
"onCommand:workbench.action.tasks.runTask",
"workspaceContains:**/tsconfig.json",
"workspaceContains:**/jsconfig.json",
"workspaceContains:**/tsconfig.*.json",
"workspaceContains:**/jsconfig.*.json"
"onLanguage:jsonc"
],
"main": "./out/extension",
"contributes": {

View file

@ -48,7 +48,7 @@
"vscode-chokidar": "1.6.2",
"vscode-debugprotocol": "1.31.0",
"vscode-nsfw": "1.0.17",
"vscode-ripgrep": "^1.0.1",
"vscode-ripgrep": "1.1.0",
"vscode-textmate": "^4.0.1",
"vscode-xterm": "3.7.0-beta4",
"winreg": "^1.2.4",

View file

@ -6,9 +6,9 @@
/// <reference path='./node.d.ts'/>
declare module 'iconv-lite' {
export function decode(buffer: NodeBuffer, encoding: string): string;
export function decode(buffer: Buffer, encoding: string): string;
export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer;
export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer;
export function encodingExists(encoding: string): boolean;

View file

@ -3,7 +3,7 @@ declare module 'jschardet' {
encoding: string,
confidence: number
}
export function detect(buffer: NodeBuffer): IDetectedMap;
export function detect(buffer: Buffer): IDetectedMap;
export const Constants: {
MINIMUM_THRESHOLD: number,

View file

@ -27,6 +27,7 @@
background-image: url(./collapsed.svg);
opacity: .7;
width: 16px;
min-width: 16px;
height: 16px;
display: inline-block;
background-size: 16px;

View file

@ -40,6 +40,7 @@
}
.monaco-icon-label > .monaco-icon-label-description-container > .label-description {
opacity: .7;
margin-left: 0.5em;
font-size: 0.9em;
white-space: pre; /* enable to show labels that include multiple whitespaces */

View file

@ -26,21 +26,19 @@ export function basenameOrAuthority(resource: URI): string {
}
/**
*
* Tests wheter a `candidate` URI is a parent or equal of a given `base` URI.
* @param base A uri which is "longer"
* @param parentCandidate A uri which is "shorter" then `base`
*/
export function isEqualOrParent(base: URI, parentCandidate: URI, ignoreCase?: boolean): boolean {
if (base.scheme === parentCandidate.scheme) {
if (base.scheme === Schemas.file) {
return paths.isEqualOrParent(base.fsPath, parentCandidate.fsPath, ignoreCase);
return paths.isEqualOrParent(fsPath(base), fsPath(parentCandidate), ignoreCase);
}
if (!isEqualAuthority(base.authority, parentCandidate.authority, ignoreCase)) {
return false;
if (isEqualAuthority(base.authority, parentCandidate.authority, ignoreCase)) {
return paths.isEqualOrParent(base.path, parentCandidate.path, ignoreCase, '/');
}
return paths.isEqualOrParent(base.path, parentCandidate.path, ignoreCase, '/');
}
return false;
}
@ -95,7 +93,7 @@ export function dirname(resource: URI): URI {
export function joinPath(resource: URI, pathFragment: string): URI {
let joinedPath: string;
if (resource.scheme === Schemas.file) {
joinedPath = URI.file(paths.join(resource.fsPath, pathFragment)).path;
joinedPath = URI.file(paths.join(fsPath(resource), pathFragment)).path;
} else {
joinedPath = paths.join(resource.path, pathFragment);
}
@ -113,7 +111,7 @@ export function joinPath(resource: URI, pathFragment: string): URI {
export function normalizePath(resource: URI): URI {
let normalizedPath: string;
if (resource.scheme === Schemas.file) {
normalizedPath = URI.file(paths.normalize(resource.fsPath)).path;
normalizedPath = URI.file(paths.normalize(fsPath(resource))).path;
} else {
normalizedPath = paths.normalize(resource.path);
}
@ -122,6 +120,32 @@ export function normalizePath(resource: URI): URI {
});
}
/**
* Returns the fsPath of an URI where the drive letter is not normalized.
* See #56403.
*/
function fsPath(uri: URI): string {
let value: string;
if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {
// unc path: file://shares/c$/far/boo
value = `//${uri.authority}${uri.path}`;
} else if (
isWindows
&& uri.path.charCodeAt(0) === CharCode.Slash
&& (uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z || uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)
&& uri.path.charCodeAt(2) === CharCode.Colon
) {
value = uri.path.substr(1);
} else {
// other path
value = uri.path;
}
if (isWindows) {
value = value.replace(/\//g, '\\');
}
return value;
}
/**
* Returns true if the URI path is absolute.
*/
@ -149,6 +173,13 @@ export function distinctParents<T>(items: T[], resourceAccessor: (item: T) => UR
return distinctParents;
}
/**
* Tests wheter the given URL is a file URI created by `URI.parse` instead of `URI.file`.
* Such URI have no scheme or scheme that consist of a single letter (windows drive letter)
* @param candidate The URI to test
* @returns A corrected, real file URI if the input seems to be malformed.
* Undefined is returned if the input URI looks fine.
*/
export function isMalformedFileUri(candidate: URI): URI | undefined {
if (!candidate.scheme || isWindows && candidate.scheme.match(/^[a-zA-Z]$/)) {
return URI.file((candidate.scheme ? candidate.scheme + ':' : '') + candidate.path);

View file

@ -685,3 +685,7 @@ export function containsUppercaseCharacter(target: string, ignoreEscapedChars =
return target.toLowerCase() !== target;
}
export function uppercaseFirstLetter(str: string): string {
return str.charAt(0).toUpperCase() + str.slice(1);
}

View file

@ -32,7 +32,7 @@ export function checksum(path: string, sha1hash: string): TPromise<void> {
input.once('error', done);
input.once('end', done);
hashStream.once('error', done);
hashStream.once('data', (data: NodeBuffer) => done(null, data.toString('hex')));
hashStream.once('data', (data: Buffer) => done(null, data.toString('hex')));
});
return promise.then(hash => {

View file

@ -25,7 +25,7 @@ export class LineDecoder {
this.remaining = null;
}
public write(buffer: NodeBuffer): string[] {
public write(buffer: Buffer): string[] {
let result: string[] = [];
let value = this.remaining
? this.remaining + this.stringDecoder.write(buffer)

View file

@ -119,11 +119,11 @@ export function bomLength(encoding: string): number {
return 0;
}
export function decode(buffer: NodeBuffer, encoding: string): string {
export function decode(buffer: Buffer, encoding: string): string {
return iconv.decode(buffer, toNodeEncoding(encoding));
}
export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer {
export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer {
return iconv.encode(content, toNodeEncoding(encoding), options);
}
@ -147,7 +147,7 @@ function toNodeEncoding(enc: string): string {
return enc;
}
export function detectEncodingByBOMFromBuffer(buffer: NodeBuffer, bytesRead: number): string {
export function detectEncodingByBOMFromBuffer(buffer: Buffer, bytesRead: number): string {
if (!buffer || bytesRead < 2) {
return null;
}
@ -193,7 +193,7 @@ const IGNORE_ENCODINGS = ['ascii', 'utf-8', 'utf-16', 'utf-32'];
/**
* Guesses the encoding from buffer.
*/
export function guessEncodingByBuffer(buffer: NodeBuffer): TPromise<string> {
export function guessEncodingByBuffer(buffer: Buffer): TPromise<string> {
return toWinJsPromise(import('jschardet')).then(jschardet => {
jschardet.Constants.MINIMUM_THRESHOLD = MINIMUM_THRESHOLD;

View file

@ -365,7 +365,7 @@ export interface IWriteFileOptions {
}
let canFlush = true;
export function writeFileAndFlush(path: string, data: string | NodeBuffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
export function writeFileAndFlush(path: string, data: string | Buffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
options = ensureOptions(options);
if (typeof data === 'string' || Buffer.isBuffer(data)) {
@ -466,7 +466,7 @@ function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream,
// not in some cache.
//
// See https://github.com/nodejs/node/blob/v5.10.0/lib/fs.js#L1194
function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
function doWriteFileAndFlush(path: string, data: string | Buffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
if (options.encoding) {
data = encode(data, options.encoding.charset, { addBOM: options.encoding.addBOM });
}
@ -503,7 +503,7 @@ function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: I
});
}
export function writeFileAndFlushSync(path: string, data: string | NodeBuffer, options?: IWriteFileOptions): void {
export function writeFileAndFlushSync(path: string, data: string | Buffer, options?: IWriteFileOptions): void {
options = ensureOptions(options);
if (options.encoding) {

View file

@ -98,7 +98,7 @@ export function readFile(path: string, encoding?: string): TPromise<Buffer | str
const writeFilePathQueue: { [path: string]: Queue<void> } = Object.create(null);
export function writeFile(path: string, data: string, options?: extfs.IWriteFileOptions): TPromise<void>;
export function writeFile(path: string, data: NodeBuffer, options?: extfs.IWriteFileOptions): TPromise<void>;
export function writeFile(path: string, data: Buffer, options?: extfs.IWriteFileOptions): TPromise<void>;
export function writeFile(path: string, data: Uint8Array, options?: extfs.IWriteFileOptions): TPromise<void>;
export function writeFile(path: string, data: NodeJS.ReadableStream, options?: extfs.IWriteFileOptions): TPromise<void>;
export function writeFile(path: string, data: any, options?: extfs.IWriteFileOptions): TPromise<void> {

View file

@ -10,7 +10,7 @@ import * as fs from 'fs';
import { TPromise } from 'vs/base/common/winjs.base';
export interface ReadResult {
buffer: NodeBuffer;
buffer: Buffer;
bytesRead: number;
}
@ -24,7 +24,7 @@ export function readExactlyByFile(file: string, totalBytes: number): TPromise<Re
return error(err);
}
function end(err: Error, resultBuffer: NodeBuffer, bytesRead: number): void {
function end(err: Error, resultBuffer: Buffer, bytesRead: number): void {
fs.close(fd, closeError => {
if (closeError) {
return error(closeError);

View file

@ -59,10 +59,19 @@ export class RowCache implements Lifecycle.IDisposable {
var row = document.createElement('div');
row.appendChild(content);
let templateData: any = null;
try {
templateData = this.context.renderer.renderTemplate(this.context.tree, templateId, content);
} catch (err) {
console.error('Tree usage error: exception while rendering template');
console.error(err);
}
result = {
element: row,
templateId: templateId,
templateData: this.context.renderer.renderTemplate(this.context.tree, templateId, content)
templateData
};
}
@ -260,7 +269,12 @@ export class ViewItem implements IViewItem {
this.element.style.width = 'fit-content';
}
this.context.renderer.renderElement(this.context.tree, this.model.getElement(), this.templateId, this.row.templateData);
try {
this.context.renderer.renderElement(this.context.tree, this.model.getElement(), this.templateId, this.row.templateData);
} catch (err) {
console.error('Tree usage error: exception while rendering element');
console.error(err);
}
if (this.context.horizontalScrolling) {
this.width = DOM.getContentWidth(this.element) + paddingLeft;

View file

@ -48,6 +48,7 @@ suite('Resources', () => {
assert.equal(dirname(URI.file('c:\\some\\file')).toString(), 'file:///c%3A/some');
assert.equal(dirname(URI.file('c:\\some\\file\\')).toString(), 'file:///c%3A/some');
assert.equal(dirname(URI.file('c:\\some')).toString(), 'file:///c%3A/');
assert.equal(dirname(URI.file('C:\\some')).toString(), 'file:///c%3A/');
} else {
assert.equal(dirname(URI.file('/some/file/test.txt')).toString(), 'file:///some/file');
assert.equal(dirname(URI.file('/some/file/')).toString(), 'file:///some');
@ -67,6 +68,7 @@ suite('Resources', () => {
assert.equal(basename(URI.file('c:\\some\\file\\test.txt')), 'test.txt');
assert.equal(basename(URI.file('c:\\some\\file')), 'file');
assert.equal(basename(URI.file('c:\\some\\file\\')), 'file');
assert.equal(basename(URI.file('C:\\some\\file\\')), 'file');
} else {
assert.equal(basename(URI.file('/some/file/test.txt')), 'test.txt');
assert.equal(basename(URI.file('/some/file/')), 'file');
@ -90,8 +92,8 @@ suite('Resources', () => {
assert.equal(joinPath(URI.file('c:\\'), 'bar/file.js').toString(), 'file:///c%3A/bar/file.js');
assert.equal(joinPath(URI.file('c:\\foo'), './file.js').toString(), 'file:///c%3A/foo/file.js');
assert.equal(joinPath(URI.file('c:\\foo'), '/./file.js').toString(), 'file:///c%3A/foo/file.js');
assert.equal(joinPath(URI.file('c:\\foo'), '../file.js').toString(), 'file:///c%3A/file.js');
assert.equal(joinPath(URI.file('c:\\foo\\.'), '../file.js').toString(), 'file:///c%3A/file.js');
assert.equal(joinPath(URI.file('C:\\foo'), '../file.js').toString(), 'file:///c%3A/file.js');
assert.equal(joinPath(URI.file('C:\\foo\\.'), '../file.js').toString(), 'file:///c%3A/file.js');
} else {
assert.equal(joinPath(URI.file('/foo/bar'), '/file.js').toString(), 'file:///foo/bar/file.js');
assert.equal(joinPath(URI.file('/foo/bar'), 'file.js').toString(), 'file:///foo/bar/file.js');
@ -123,8 +125,8 @@ suite('Resources', () => {
assert.equal(normalizePath(URI.file('c:\\foo\\..\\bar')).toString(), 'file:///c%3A/bar');
assert.equal(normalizePath(URI.file('c:\\foo\\..\\..\\bar')).toString(), 'file:///c%3A/bar');
assert.equal(normalizePath(URI.file('c:\\foo\\foo\\..\\..\\bar')).toString(), 'file:///c%3A/bar');
assert.equal(normalizePath(URI.file('c:\\foo\\foo\\.\\..\\..\\bar')).toString(), 'file:///c%3A/bar');
assert.equal(normalizePath(URI.file('c:\\foo\\foo\\.\\..\\some\\..\\bar')).toString(), 'file:///c%3A/foo/bar');
assert.equal(normalizePath(URI.file('C:\\foo\\foo\\.\\..\\..\\bar')).toString(), 'file:///c%3A/bar');
assert.equal(normalizePath(URI.file('C:\\foo\\foo\\.\\..\\some\\..\\bar')).toString(), 'file:///c%3A/foo/bar');
} else {
assert.equal(normalizePath(URI.file('/foo/./bar')).toString(), 'file:///foo/bar');
assert.equal(normalizePath(URI.file('/foo/.')).toString(), 'file:///foo');
@ -150,6 +152,7 @@ suite('Resources', () => {
test('isAbsolute', () => {
if (isWindows) {
assert.equal(isAbsolutePath(URI.file('c:\\foo\\')), true);
assert.equal(isAbsolutePath(URI.file('C:\\foo\\')), true);
assert.equal(isAbsolutePath(URI.file('bar')), true); // URI normalizes all file URIs to be absolute
} else {
assert.equal(isAbsolutePath(URI.file('/foo/bar')), true);
@ -160,8 +163,8 @@ suite('Resources', () => {
});
test('isEqual', () => {
let fileURI = URI.file('/foo/bar');
let fileURI2 = URI.file('/foo/Bar');
let fileURI = isWindows ? URI.file('c:\\foo\\bar') : URI.file('/foo/bar');
let fileURI2 = isWindows ? URI.file('C:\\foo\\Bar') : URI.file('/foo/Bar');
assert.equal(isEqual(fileURI, fileURI, true), true);
assert.equal(isEqual(fileURI, fileURI, false), true);
assert.equal(isEqual(fileURI, fileURI, hasToIgnoreCase(fileURI)), true);
@ -176,7 +179,6 @@ suite('Resources', () => {
assert.equal(isEqual(fileURI3, fileURI4, true), true);
assert.equal(isEqual(fileURI3, fileURI4, false), false);
assert.equal(isEqual(fileURI, fileURI3, true), false);
});
@ -214,6 +216,7 @@ suite('Resources', () => {
if (isWindows) {
assertMalformedFileUri('c:/foo/bar', 'file:///c%3A/foo/bar');
assertMalformedFileUri('c:\\foo\\bar', 'file:///c%3A/foo/bar');
assertMalformedFileUri('C:\\foo\\bar', 'file:///c%3A/foo/bar');
assertMalformedFileUri('\\\\localhost\\c$\\devel\\test', 'file://localhost/c%24/devel/test');
}
assertMalformedFileUri('/foo/bar', 'file:///foo/bar');

View file

@ -381,4 +381,16 @@ suite('Strings', () => {
assert.equal(strings.containsUppercaseCharacter(<string>str, true), result, `Wrong result for ${str}`);
});
});
test('uppercaseFirstLetter', () => {
[
['', ''],
['foo', 'Foo'],
['f', 'F'],
['123', '123'],
['.a', '.a'],
].forEach(([inStr, result]) => {
assert.equal(strings.uppercaseFirstLetter(inStr), result, `Wrong result for ${inStr}`);
});
});
});

View file

@ -63,7 +63,7 @@ import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
import { IMenubarService } from 'vs/platform/menubar/common/menubar';
import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService';
import { MenubarChannel } from 'vs/platform/menubar/common/menubarIpc';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { CodeMenu } from 'vs/code/electron-main/menus';
import { hasArgs } from 'vs/platform/environment/node/argv';
import { RunOnceScheduler } from 'vs/base/common/async';
@ -90,7 +90,7 @@ export class CodeApplication {
@IConfigurationService private configurationService: ConfigurationService,
@IStateService private stateService: IStateService,
@IHistoryMainService private historyMainService: IHistoryMainService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
this.toDispose = [mainIpcServer, configurationService];
@ -225,8 +225,8 @@ export class CodeApplication {
}
});
ipc.on('vscode:uriDisplayRegisterFormater', (event: any, { scheme, formater }) => {
this.uriDisplayService.registerFormater(scheme, formater);
ipc.on('vscode:uriLabelRegisterFormater', (event: any, { scheme, formater }) => {
this.uriLabelService.registerFormater(scheme, formater);
});
// Keyboard layout changes

View file

@ -50,7 +50,7 @@ import { uploadLogs } from 'vs/code/electron-main/logUploader';
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { CommandLineDialogService } from 'vs/platform/dialogs/node/dialogService';
import { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
function createServices(args: ParsedArgs, bufferLogService: BufferLogService): IInstantiationService {
const services = new ServiceCollection();
@ -58,7 +58,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I
const environmentService = new EnvironmentService(args, process.execPath);
const consoleLogService = new ConsoleLogMainService(getLogLevel(environmentService));
const logService = new MultiplexLogService([consoleLogService, bufferLogService]);
const uriDisplayService = new UriDisplayService(environmentService, undefined);
const uriLabelService = new UriLabelService(environmentService, undefined);
process.once('exit', () => logService.dispose());
@ -66,7 +66,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I
setTimeout(() => cleanupOlderLogs(environmentService).then(null, err => console.error(err)), 10000);
services.set(IEnvironmentService, environmentService);
services.set(IUriDisplayService, uriDisplayService);
services.set(IUriLabelService, uriLabelService);
services.set(ILogService, logService);
services.set(IWorkspacesMainService, new SyncDescriptor(WorkspacesMainService));
services.set(IHistoryMainService, new SyncDescriptor(HistoryMainService));

View file

@ -22,7 +22,7 @@ import { IHistoryMainService } from 'vs/platform/history/common/history';
import { IWorkspaceIdentifier, getWorkspaceLabel, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IMenubarData, IMenubarKeybinding, MenubarMenuItem, isMenubarMenuItemSeparator, isMenubarMenuItemSubmenu, isMenubarMenuItemAction } from 'vs/platform/menubar/common/menubar';
import URI from 'vs/base/common/uri';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
const telemetryFrom = 'menu';
@ -49,7 +49,7 @@ export class Menubar {
@IEnvironmentService private environmentService: IEnvironmentService,
@ITelemetryService private telemetryService: ITelemetryService,
@IHistoryMainService private historyMainService: IHistoryMainService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
this.menuUpdater = new RunOnceScheduler(() => this.doUpdateMenu(), 0);
@ -563,13 +563,13 @@ export class Menubar {
let label: string;
let uri: URI;
if (isSingleFolderWorkspaceIdentifier(workspaceOrFile) && !isFile) {
label = unmnemonicLabel(getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriDisplayService, { verbose: true }));
label = unmnemonicLabel(getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriLabelService, { verbose: true }));
uri = workspaceOrFile;
} else if (isWorkspaceIdentifier(workspaceOrFile)) {
label = getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriDisplayService, { verbose: true });
label = getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriLabelService, { verbose: true });
uri = URI.file(workspaceOrFile.configPath);
} else {
label = unmnemonicLabel(this.uriDisplayService.getLabel(workspaceOrFile));
label = unmnemonicLabel(this.uriLabelService.getLabel(workspaceOrFile));
uri = workspaceOrFile;
}

View file

@ -24,7 +24,7 @@ import { IWindowsMainService, IWindowsCountChangedEvent } from 'vs/platform/wind
import { IHistoryMainService } from 'vs/platform/history/common/history';
import { IWorkspaceIdentifier, getWorkspaceLabel, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import URI from 'vs/base/common/uri';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
interface IMenuItemClickHandler {
inDevTools: (contents: Electron.WebContents) => void;
@ -68,7 +68,7 @@ export class CodeMenu {
@IEnvironmentService private environmentService: IEnvironmentService,
@ITelemetryService private telemetryService: ITelemetryService,
@IHistoryMainService private historyMainService: IHistoryMainService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
this.nativeTabMenuItems = [];
@ -496,14 +496,14 @@ export class CodeMenu {
let label: string;
let uri: URI;
if (isSingleFolderWorkspaceIdentifier(workspace)) {
label = unmnemonicLabel(getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true }));
label = unmnemonicLabel(getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true }));
uri = workspace;
} else if (isWorkspaceIdentifier(workspace)) {
label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true });
label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true });
uri = URI.file(workspace.configPath);
} else {
uri = URI.file(workspace);
label = unmnemonicLabel(this.uriDisplayService.getLabel(uri));
label = unmnemonicLabel(this.uriLabelService.getLabel(uri));
}
return new MenuItem(this.likeAction(commandId, {
@ -1319,4 +1319,4 @@ export class CodeMenu {
function __separator__(): Electron.MenuItem {
return new MenuItem({ type: 'separator' });
}
}

View file

@ -40,7 +40,7 @@ import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Location } from 'vs/editor/common/modes';
import { ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { dirname, basenameOrAuthority } from 'vs/base/common/resources';
import { getBaseLabel } from 'vs/base/common/labels';
@ -300,7 +300,7 @@ class FileReferencesTemplate {
constructor(
container: HTMLElement,
@IUriDisplayService private readonly _uriDisplay: IUriDisplayService,
@IUriLabelService private readonly _uriLabel: IUriLabelService,
@IThemeService themeService: IThemeService,
) {
const parent = document.createElement('div');
@ -319,7 +319,7 @@ class FileReferencesTemplate {
set(element: FileReferences) {
let parent = dirname(element.uri);
this.file.setValue(getBaseLabel(element.uri), parent ? this._uriDisplay.getLabel(parent, true) : undefined, { title: this._uriDisplay.getLabel(element.uri) });
this.file.setValue(getBaseLabel(element.uri), parent ? this._uriLabel.getLabel(parent, true) : undefined, { title: this._uriLabel.getLabel(element.uri) });
const len = element.children.length;
this.badge.setCount(len);
if (element.failure) {
@ -368,7 +368,7 @@ class Renderer implements tree.IRenderer {
constructor(
@IThemeService private readonly _themeService: IThemeService,
@IUriDisplayService private readonly _uriDisplay: IUriDisplayService,
@IUriLabelService private readonly _uriLabel: IUriLabelService,
) {
//
}
@ -388,7 +388,7 @@ class Renderer implements tree.IRenderer {
renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement) {
if (templateId === Renderer._ids.FileReferences) {
return new FileReferencesTemplate(container, this._uriDisplay, this._themeService);
return new FileReferencesTemplate(container, this._uriLabel, this._themeService);
} else if (templateId === Renderer._ids.OneReference) {
return new OneReferenceTemplate(container);
}
@ -532,7 +532,7 @@ export class ReferenceWidget extends PeekViewWidget {
@IThemeService themeService: IThemeService,
@ITextModelService private _textModelResolverService: ITextModelService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IUriDisplayService private _uriDisplay: IUriDisplayService
@IUriLabelService private _uriLabel: IUriLabelService
) {
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true });
@ -778,7 +778,7 @@ export class ReferenceWidget extends PeekViewWidget {
// Update widget header
if (reference.uri.scheme !== Schemas.inMemory) {
this.setTitle(basenameOrAuthority(reference.uri), this._uriDisplay.getLabel(dirname(reference.uri), false));
this.setTitle(basenameOrAuthority(reference.uri), this._uriLabel.getLabel(dirname(reference.uri), false));
} else {
this.setTitle(nls.localize('peekView.alternateTitle', "References"));
}

View file

@ -45,7 +45,7 @@ import { WorkspaceEdit, isResourceTextEdit, TextEdit } from 'vs/editor/common/mo
import { IModelService } from 'vs/editor/common/services/modelService';
import { EditOperation } from 'vs/editor/common/core/editOperation';
import { localize } from 'vs/nls';
import { IUriDisplayService, UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService, UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel';
export class SimpleModel implements ITextEditorModel {
@ -592,11 +592,11 @@ export class SimpleBulkEditService implements IBulkEditService {
}
}
export class SimpleUriDisplayService implements IUriDisplayService {
export class SimpleUriLabelService implements IUriLabelService {
_serviceBrand: any;
private readonly _onDidRegisterFormater: Emitter<{ scheme: string, formater: UriDisplayRules }> = new Emitter<{ scheme: string, formater: UriDisplayRules }>();
public readonly onDidRegisterFormater: Event<{ scheme: string, formater: UriDisplayRules }> = this._onDidRegisterFormater.event;
private readonly _onDidRegisterFormater: Emitter<{ scheme: string, formater: UriLabelRules }> = new Emitter<{ scheme: string, formater: UriLabelRules }>();
public readonly onDidRegisterFormater: Event<{ scheme: string, formater: UriLabelRules }> = this._onDidRegisterFormater.event;
public getLabel(resource: URI, relative?: boolean): string {
if (resource.scheme === 'file') {
@ -605,7 +605,7 @@ export class SimpleUriDisplayService implements IUriDisplayService {
return resource.path;
}
public registerFormater(schema: string, formater: UriDisplayRules): IDisposable {
public registerFormater(schema: string, formater: UriLabelRules): IDisposable {
throw new Error('Not implemented');
}
}

View file

@ -33,7 +33,7 @@ import { StandaloneCodeEditorServiceImpl } from 'vs/editor/standalone/browser/st
import {
SimpleConfigurationService, SimpleResourceConfigurationService, SimpleMenuService,
SimpleProgressService, StandaloneCommandService, StandaloneKeybindingService, SimpleNotificationService,
StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleDialogService, SimpleBulkEditService, SimpleUriDisplayService
StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleDialogService, SimpleBulkEditService, SimpleUriLabelService
} from 'vs/editor/standalone/browser/simpleServices';
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
import { IMenuService } from 'vs/platform/actions/common/actions';
@ -44,7 +44,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IListService, ListService } from 'vs/platform/list/browser/listService';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export interface IEditorOverrideServices {
[index: string]: any;
@ -122,7 +122,7 @@ export module StaticServices {
export const contextService = define(IWorkspaceContextService, () => new SimpleWorkspaceContextService());
export const uriDisplayService = define(IUriDisplayService, () => new SimpleUriDisplayService());
export const uriLabelService = define(IUriLabelService, () => new SimpleUriLabelService());
export const telemetryService = define(ITelemetryService, () => new StandaloneTelemetryService());

View file

@ -22,7 +22,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { getComparisonKey, isEqual as areResourcesEqual, hasToIgnoreCase, dirname } from 'vs/base/common/resources';
import URI, { UriComponents } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
interface ISerializedRecentlyOpened {
workspaces2: (IWorkspaceIdentifier | string)[]; // IWorkspaceIdentifier or URI.toString()
@ -53,7 +53,7 @@ export class HistoryMainService implements IHistoryMainService {
@ILogService private logService: ILogService,
@IWorkspacesMainService private workspacesMainService: IWorkspacesMainService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
this.macOSRecentDocumentsUpdater = new RunOnceScheduler(() => this.updateMacOSRecentDocuments(), 800);
@ -368,11 +368,11 @@ export class HistoryMainService implements IHistoryMainService {
type: 'custom',
name: nls.localize('recentFolders', "Recent Workspaces"),
items: this.getRecentlyOpened().workspaces.slice(0, 7 /* limit number of entries here */).map(workspace => {
const title = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService);
const title = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService);
let description;
let args;
if (isSingleFolderWorkspaceIdentifier(workspace)) {
description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.uriDisplayService.getLabel(dirname(workspace)));
description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.uriLabelService.getLabel(dirname(workspace)));
args = `--folder-uri "${workspace.toString()}"`;
} else {
description = nls.localize('codeWorkspace', "Code Workspace");

View file

@ -11,24 +11,24 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { isEqual, basenameOrAuthority } from 'vs/base/common/resources';
import { isLinux, isWindows } from 'vs/base/common/platform';
import { tildify } from 'vs/base/common/labels';
import { tildify, getPathLabel } from 'vs/base/common/labels';
import { ltrim } from 'vs/base/common/strings';
export interface IUriDisplayService {
export interface IUriLabelService {
_serviceBrand: any;
getLabel(resource: URI, relative?: boolean): string;
registerFormater(schema: string, formater: UriDisplayRules): IDisposable;
onDidRegisterFormater: Event<{ scheme: string, formater: UriDisplayRules }>;
registerFormater(schema: string, formater: UriLabelRules): IDisposable;
onDidRegisterFormater: Event<{ scheme: string, formater: UriLabelRules }>;
}
export interface UriDisplayRules {
export interface UriLabelRules {
label: string; // myLabel:/${path}
separator: '/' | '\\' | '';
tildify?: boolean;
normalizeDriveLetter?: boolean;
}
const URI_DISPLAY_SERVICE_ID = 'uriDisplay';
const URI_LABEL_SERVICE_ID = 'uriLabel';
const sepRegexp = /\//g;
const labelMatchingRegexp = /\$\{scheme\}|\$\{authority\}|\$\{path\}/g;
@ -36,11 +36,11 @@ function hasDriveLetter(path: string): boolean {
return isWindows && path && path[2] === ':';
}
export class UriDisplayService implements IUriDisplayService {
export class UriLabelService implements IUriLabelService {
_serviceBrand: any;
private readonly formaters = new Map<string, UriDisplayRules>();
private readonly _onDidRegisterFormater = new Emitter<{ scheme: string, formater: UriDisplayRules }>();
private readonly formaters = new Map<string, UriLabelRules>();
private readonly _onDidRegisterFormater = new Emitter<{ scheme: string, formater: UriLabelRules }>();
constructor(
@IEnvironmentService private environmentService: IEnvironmentService,
@ -48,7 +48,7 @@ export class UriDisplayService implements IUriDisplayService {
) { }
get onDidRegisterFormater(): Event<{ scheme: string, formater: UriDisplayRules }> {
get onDidRegisterFormater(): Event<{ scheme: string, formater: UriLabelRules }> {
return this._onDidRegisterFormater.event;
}
@ -58,7 +58,7 @@ export class UriDisplayService implements IUriDisplayService {
}
const formater = this.formaters.get(resource.scheme);
if (!formater) {
return resource.path;
return getPathLabel(resource.path, this.environmentService, relative ? this.contextService : undefined);
}
if (relative) {
@ -85,7 +85,7 @@ export class UriDisplayService implements IUriDisplayService {
return this.formatUri(resource, formater);
}
registerFormater(scheme: string, formater: UriDisplayRules): IDisposable {
registerFormater(scheme: string, formater: UriLabelRules): IDisposable {
this.formaters.set(scheme, formater);
this._onDidRegisterFormater.fire({ scheme, formater });
@ -94,7 +94,7 @@ export class UriDisplayService implements IUriDisplayService {
};
}
private formatUri(resource: URI, formater: UriDisplayRules): string {
private formatUri(resource: URI, formater: UriLabelRules): string {
let label = formater.label.replace(labelMatchingRegexp, match => {
switch (match) {
case '${scheme}': return resource.scheme;
@ -117,4 +117,4 @@ export class UriDisplayService implements IUriDisplayService {
}
}
export const IUriDisplayService = createDecorator<IUriDisplayService>(URI_DISPLAY_SERVICE_ID);
export const IUriLabelService = createDecorator<IUriLabelService>(URI_LABEL_SERVICE_ID);

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { ipcRenderer as ipc } from 'electron';
import { Registry } from 'vs/platform/registry/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
@ -13,13 +13,13 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
* Uri display registration needs to be shared from renderer to main.
* Since there will be another instance of the uri display service running on main.
*/
class UriDisplayRegistrationContribution implements IWorkbenchContribution {
class UriLabelRegistrationContribution implements IWorkbenchContribution {
constructor(@IUriDisplayService uriDisplayService: IUriDisplayService) {
uriDisplayService.onDidRegisterFormater(data => {
ipc.send('vscode:uriDisplayRegisterFormater', data);
constructor(@IUriLabelService uriLabelService: IUriLabelService) {
uriLabelService.onDidRegisterFormater(data => {
ipc.send('vscode:uriLabelRegisterFormater', data);
});
}
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(UriDisplayRegistrationContribution, LifecyclePhase.Starting);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(UriLabelRegistrationContribution, LifecyclePhase.Starting);

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
import { Schemas } from 'vs/base/common/network';
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
@ -12,16 +12,16 @@ import URI from 'vs/base/common/uri';
import { nativeSep } from 'vs/base/common/paths';
import { isWindows } from 'vs/base/common/platform';
suite('URI Display', () => {
suite('URI Label', () => {
let uriDisplayService: IUriDisplayService;
let uriLabelService: IUriLabelService;
setup(() => {
uriDisplayService = new UriDisplayService(TestEnvironmentService, new TestContextService());
uriLabelService = new UriLabelService(TestEnvironmentService, new TestContextService());
});
test('file scheme', function () {
uriDisplayService.registerFormater(Schemas.file, {
uriLabelService.registerFormater(Schemas.file, {
label: '${path}',
separator: nativeSep,
tildify: !isWindows,
@ -29,15 +29,15 @@ suite('URI Display', () => {
});
const uri1 = TestWorkspace.folders[0].uri.with({ path: TestWorkspace.folders[0].uri.path.concat('/a/b/c/d') });
assert.equal(uriDisplayService.getLabel(uri1, true), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d');
assert.equal(uriDisplayService.getLabel(uri1, false), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/a/b/c/d');
assert.equal(uriLabelService.getLabel(uri1, true), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d');
assert.equal(uriLabelService.getLabel(uri1, false), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/a/b/c/d');
const uri2 = URI.file('c:\\1/2/3');
assert.equal(uriDisplayService.getLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3');
assert.equal(uriLabelService.getLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3');
});
test('custom scheme', function () {
uriDisplayService.registerFormater(Schemas.vscode, {
uriLabelService.registerFormater(Schemas.vscode, {
label: 'LABEL/${path}/${authority}/END',
separator: '/',
tildify: true,
@ -45,6 +45,6 @@ suite('URI Display', () => {
});
const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5');
assert.equal(uriDisplayService.getLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END');
assert.equal(uriLabelService.getLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END');
});
});

View file

@ -17,7 +17,7 @@ import { getBaseLabel } from 'vs/base/common/labels';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import URI from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export const IWorkspacesMainService = createDecorator<IWorkspacesMainService>('workspacesMainService');
export const IWorkspacesService = createDecorator<IWorkspacesService>('workspacesService');
@ -113,17 +113,17 @@ export interface IWorkspacesService {
createWorkspace(folders?: IWorkspaceFolderCreationData[]): TPromise<IWorkspaceIdentifier>;
}
export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, uriDisplayService: IUriDisplayService, options?: { verbose: boolean }): string {
export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, uriLabelService: IUriLabelService, options?: { verbose: boolean }): string {
// Workspace: Single Folder
if (isSingleFolderWorkspaceIdentifier(workspace)) {
// Folder on disk
if (workspace.scheme === Schemas.file) {
return options && options.verbose ? uriDisplayService.getLabel(workspace) : getBaseLabel(workspace);
return options && options.verbose ? uriLabelService.getLabel(workspace) : getBaseLabel(workspace);
}
// Remote folder
return options && options.verbose ? uriDisplayService.getLabel(workspace) : `${getBaseLabel(workspace)} (${workspace.scheme})`;
return options && options.verbose ? uriLabelService.getLabel(workspace) : `${getBaseLabel(workspace)} (${workspace.scheme})`;
}
// Workspace: Untitled
@ -135,7 +135,7 @@ export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFold
const filename = basename(workspace.configPath);
const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
if (options && options.verbose) {
return localize('workspaceNameVerbose', "{0} (Workspace)", uriDisplayService.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName))));
return localize('workspaceNameVerbose', "{0} (Workspace)", uriLabelService.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName))));
}
return localize('workspaceName', "{0} (Workspace)", workspaceName);

View file

@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { FileWriteOptions, FileSystemProviderCapabilities, IFileChange, IFileService, IFileSystemProvider, IStat, IWatchOptions, FileType, FileOverwriteOptions, FileDeleteOptions } from 'vs/platform/files/common/files';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { ExtHostContext, ExtHostFileSystemShape, IExtHostContext, IFileChangeDto, MainContext, MainThreadFileSystemShape } from '../node/extHost.protocol';
import { UriDisplayRules, IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { UriLabelRules, IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
@extHostNamedCustomer(MainContext.MainThreadFileSystem)
export class MainThreadFileSystem implements MainThreadFileSystemShape {
@ -22,7 +22,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
constructor(
extHostContext: IExtHostContext,
@IFileService private readonly _fileService: IFileService,
@IUriDisplayService private readonly _uriDisplayService: IUriDisplayService
@IUriLabelService private readonly _uriLabelService: IUriLabelService
) {
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostFileSystem);
}
@ -41,8 +41,8 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
this._fileProvider.delete(handle);
}
$setUriFormatter(scheme: string, formatter: UriDisplayRules): void {
this._uriDisplayService.registerFormater(scheme, formatter);
$setUriFormatter(scheme: string, formatter: UriLabelRules): void {
this._uriLabelService.registerFormater(scheme, formatter);
}
$onFileSystemChange(handle: number, changes: IFileChangeDto[]): void {

View file

@ -40,7 +40,7 @@ import { IExtensionDescription } from 'vs/workbench/services/extensions/common/e
import { createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId, IRPCProtocol, ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { IProgressOptions, IProgressStep } from 'vs/workbench/services/progress/common/progress';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
import { UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay';
import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel';
import * as vscode from 'vscode';
export interface IEnvironment {
@ -483,7 +483,7 @@ export interface IFileChangeDto {
export interface MainThreadFileSystemShape extends IDisposable {
$registerFileSystemProvider(handle: number, scheme: string, capabilities: FileSystemProviderCapabilities): void;
$unregisterProvider(handle: number): void;
$setUriFormatter(scheme: string, formatter: UriDisplayRules): void;
$setUriFormatter(scheme: string, formatter: UriLabelRules): void;
$onFileSystemChange(handle: number, resource: IFileChangeDto[]): void;
}

View file

@ -53,7 +53,7 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
}
const { provider, extensionId } = this._provider.get(handle);
return asWinJsPromise(token => provider.provideDecoration(URI.revive(uri), token)).then(data => {
if (data.letter && data.letter.length !== 1) {
if (data && data.letter && data.letter.length !== 1) {
console.warn(`INVALID decoration from extension '${extensionId}'. The 'letter' must be set and be one character, not '${data.letter}'.`);
}
result[id] = data && <DecorationData>[data.priority, data.bubble, data.title, data.letter, data.color, data.source];

View file

@ -15,7 +15,7 @@ import { values } from 'vs/base/common/map';
import { Range, FileChangeType } from 'vs/workbench/api/node/extHostTypes';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures';
import { Schemas } from 'vs/base/common/network';
import { UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay';
import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel';
class FsLinkProvider implements vscode.DocumentLinkProvider {
@ -142,7 +142,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
});
}
setUriFormatter(scheme: string, formatter: UriDisplayRules): void {
setUriFormatter(scheme: string, formatter: UriLabelRules): void {
this._proxy.$setUriFormatter(scheme, formatter);
}

View file

@ -22,7 +22,7 @@ import { FileKind, isParent } from 'vs/platform/files/common/files';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { isLinux } from 'vs/base/common/platform';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { IQuickInputService, IPickOptions, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { getIconClasses } from 'vs/workbench/browser/labels';
import { IModelService } from 'vs/editor/common/services/modelService';
@ -163,7 +163,7 @@ CommandsRegistry.registerCommand({
CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (accessor, args?: [IPickOptions<IQuickPickItem>, CancellationToken]) {
const quickInputService = accessor.get(IQuickInputService);
const uriDisplayService = accessor.get(IUriDisplayService);
const uriLabelService = accessor.get(IUriLabelService);
const contextService = accessor.get(IWorkspaceContextService);
const modelService = accessor.get(IModelService);
const modeService = accessor.get(IModeService);
@ -176,7 +176,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (acc
const folderPicks = folders.map(folder => {
return {
label: folder.name,
description: uriDisplayService.getLabel(resources.dirname(folder.uri), true),
description: uriLabelService.getLabel(resources.dirname(folder.uri), true),
folder,
iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER)
} as IQuickPickItem;

View file

@ -23,7 +23,7 @@ import { ITextModel } from 'vs/editor/common/model';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Event, Emitter } from 'vs/base/common/event';
import { DataUri } from 'vs/workbench/common/resources';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export interface IResourceLabel {
name: string;
@ -56,7 +56,7 @@ export class ResourceLabel extends IconLabel {
@IModelService private modelService: IModelService,
@IDecorationsService protected decorationsService: IDecorationsService,
@IThemeService private themeService: IThemeService,
@IUriDisplayService protected uriDisplayService: IUriDisplayService
@IUriLabelService protected uriLabelService: IUriLabelService
) {
super(container, options);
@ -191,7 +191,7 @@ export class ResourceLabel extends IconLabel {
iconLabelOptions.title = this.options.title;
} else if (resource && resource.scheme !== Schemas.data /* do not accidentally inline Data URIs */) {
if (!this.computedPathLabel) {
this.computedPathLabel = this.uriDisplayService.getLabel(resource);
this.computedPathLabel = this.uriLabelService.getLabel(resource);
}
iconLabelOptions.title = this.computedPathLabel;
@ -274,9 +274,9 @@ export class FileLabel extends ResourceLabel {
@IDecorationsService decorationsService: IDecorationsService,
@IThemeService themeService: IThemeService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IUriDisplayService uriDisplayService: IUriDisplayService
@IUriLabelService uriLabelService: IUriLabelService
) {
super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, uriDisplayService);
super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, uriLabelService);
}
setFile(resource: uri, options?: IFileLabelOptions): void {
@ -298,7 +298,7 @@ export class FileLabel extends ResourceLabel {
let description: string;
const hidePath = (options && options.hidePath) || (resource.scheme === Schemas.untitled && !this.untitledEditorService.hasAssociatedFilePath(resource));
if (!hidePath) {
description = this.uriDisplayService.getLabel(resources.dirname(resource), true);
description = this.uriLabelService.getLabel(resources.dirname(resource), true);
}
this.setLabel({ resource, name, description }, options);

View file

@ -57,8 +57,10 @@ registerSingleton(IBreadcrumbsService, BreadcrumbsService);
export abstract class BreadcrumbsConfig<T> {
name: string;
value: T;
onDidChange: Event<T>;
abstract value(): T;
abstract value(value: T): Thenable<void>;
abstract dispose(): void;
private constructor() {
@ -83,16 +85,19 @@ export abstract class BreadcrumbsConfig<T> {
}
});
return {
name,
get value() {
return value;
},
set value(newValue: T) {
service.updateValue(name, newValue);
value = newValue;
},
onDidChange: onDidChange.event,
return new class implements BreadcrumbsConfig<T>{
readonly name = name;
readonly onDidChange = onDidChange.event;
value(): T;
value(value: T): Thenable<void>;
value(newValue?: T): any {
if (arguments.length === 0) {
return value;
} else {
value = newValue;
return service.updateValue(name, newValue);
}
}
dispose(): void {
listener.dispose();
onDidChange.dispose();

View file

@ -22,7 +22,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
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 { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
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';
@ -41,6 +41,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { tail } from 'vs/base/common/arrays';
import { WorkbenchListFocusContextKey } from 'vs/platform/list/browser/listService';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { timeout } from 'vs/base/common/async';
class Item extends BreadcrumbsItem {
@ -270,7 +271,7 @@ export class BreadcrumbsControl {
return;
}
if (this._cfUseQuickPick.value) {
if (this._cfUseQuickPick.value()) {
// using quick pick
this._widget.setFocused(undefined);
this._widget.setSelection(undefined);
@ -295,7 +296,7 @@ export class BreadcrumbsControl {
getAnchor: () => {
let pickerHeight = 330;
let pickerWidth = Math.max(this._dimension.width * 0.38, dom.getTotalWidth(event.node));
let pickerWidth = Math.max(this._dimension.width / 2.59, dom.getTotalWidth(event.node));
let pickerArrowSize = 8;
let pickerArrowOffset: number;
@ -366,6 +367,7 @@ export class BreadcrumbsControl {
//#region commands
// toggle command
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: 'breadcrumbs.toggle',
@ -383,10 +385,31 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
});
CommandsRegistry.registerCommand('breadcrumbs.toggle', accessor => {
let config = accessor.get(IConfigurationService);
let value = BreadcrumbsConfig.IsEnabled.bindTo(config).value;
BreadcrumbsConfig.IsEnabled.bindTo(config).value = !value;
let value = BreadcrumbsConfig.IsEnabled.bindTo(config).value();
BreadcrumbsConfig.IsEnabled.bindTo(config).value(!value);
});
// focus/focus-and-select
async function focusAndSelectHandler(accessor: ServicesAccessor, select: boolean): Promise<void> {
const groups = accessor.get(IEditorGroupsService);
const breadcrumbs = accessor.get(IBreadcrumbsService);
const config = accessor.get(IConfigurationService);
// check if enabled and iff not enable
const isEnabled = BreadcrumbsConfig.IsEnabled.bindTo(config);
if (!isEnabled.value()) {
await isEnabled.value(true);
await timeout(50); // hacky - the widget might not be ready yet...
}
// find widget and focus/select
const widget = breadcrumbs.getWidget(groups.activeGroup.id);
if (widget) {
const item = tail(widget.getItems());
widget.setFocused(item);
if (select) {
widget.setSelection(item, BreadcrumbsControl.Payload_Pick);
}
}
}
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: 'breadcrumbs.focusAndSelect',
@ -398,34 +421,18 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focusAndSelect',
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT,
when: BreadcrumbsControl.CK_BreadcrumbsVisible,
handler(accessor) {
const groups = accessor.get(IEditorGroupsService);
const breadcrumbs = accessor.get(IBreadcrumbsService);
const widget = breadcrumbs.getWidget(groups.activeGroup.id);
if (widget) {
const item = tail(widget.getItems());
widget.setFocused(item);
widget.setSelection(item, BreadcrumbsControl.Payload_Pick);
}
}
when: undefined,
handler: accessor => focusAndSelectHandler(accessor, true)
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focus',
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_SEMICOLON,
when: BreadcrumbsControl.CK_BreadcrumbsVisible,
handler(accessor) {
const groups = accessor.get(IEditorGroupsService);
const breadcrumbs = accessor.get(IBreadcrumbsService);
const widget = breadcrumbs.getWidget(groups.activeGroup.id);
if (widget) {
const item = tail(widget.getItems());
widget.setFocused(item);
}
}
when: undefined,
handler: accessor => focusAndSelectHandler(accessor, false)
});
// navigation
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.focusNext',
weight: KeybindingWeight.WorkbenchContrib,

View file

@ -81,16 +81,16 @@ export class EditorBreadcrumbsModel {
let result: BreadcrumbElement[] = [];
// file path elements
if (this._cfgFilePath.value === 'on') {
if (this._cfgFilePath.value() === 'on') {
result = result.concat(this._fileInfo.path);
} else if (this._cfgFilePath.value === 'last' && this._fileInfo.path.length > 0) {
} else if (this._cfgFilePath.value() === 'last' && this._fileInfo.path.length > 0) {
result = result.concat(this._fileInfo.path.slice(-1));
}
// symbol path elements
if (this._cfgSymbolPath.value === 'on') {
if (this._cfgSymbolPath.value() === 'on') {
result = result.concat(this._outlineElements);
} else if (this._cfgSymbolPath.value === 'last' && this._outlineElements.length > 0) {
} else if (this._cfgSymbolPath.value() === 'last' && this._outlineElements.length > 0) {
result = result.concat(this._outlineElements.slice(-1));
}

View file

@ -419,13 +419,16 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
// Mark preferred size as changed
this.resetPreferredSize();
// Events for groupd that got added
// Events for groups that got added
this.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(groupView => {
if (currentGroupViews.indexOf(groupView) === -1) {
this._onDidAddGroup.fire(groupView);
}
});
// Update labels
this.updateGroupLabels();
// Restore focus as needed
if (gridHasFocus) {
this._activeGroup.focus();
@ -475,6 +478,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
// Event
this._onDidAddGroup.fire(newGroupView);
// Update labels
this.updateGroupLabels();
return newGroupView;
}
@ -631,12 +637,8 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
this._activeGroup.focus();
}
// Update labels: since our labels are created using the index of the
// group, removing a group might produce gaps. So we iterate over all
// groups and reassign the label based on the index.
this.getGroups(GroupsOrder.CREATION_TIME).forEach((group, index) => {
group.setLabel(this.getGroupLabel(index + 1));
});
// Update labels
this.updateGroupLabels();
// Update container
this.updateContainer();
@ -648,10 +650,6 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
this._onDidRemoveGroup.fire(groupView);
}
private getGroupLabel(index: number): string {
return localize('groupLabel', "Group {0}", index);
}
moveGroup(group: IEditorGroupView | GroupIdentifier, location: IEditorGroupView | GroupIdentifier, direction: GroupDirection): IEditorGroupView {
const sourceView = this.assertGroupView(group);
const targetView = this.assertGroupView(location);
@ -887,6 +885,21 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
toggleClass(this.container, 'empty', this.isEmpty());
}
private updateGroupLabels(): void {
// Since our labels are created using the index of the
// group, adding/removing a group might produce gaps.
// So we iterate over all groups and reassign the label
// based on the index.
this.getGroups(GroupsOrder.GRID_APPEARANCE).forEach((group, index) => {
group.setLabel(this.getGroupLabel(index + 1));
});
}
private getGroupLabel(index: number): string {
return localize('groupLabel', "Group {0}", index);
}
private isEmpty(): boolean {
return this.groupViews.size === 1 && this._activeGroup.isEmpty();
}

View file

@ -117,7 +117,7 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
// Sorting
if (query.value) {
const groups = this.editorGroupService.getGroups(GroupsOrder.CREATION_TIME);
const groups = this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE);
entries.sort((e1, e2) => {
if (e1.group !== e2.group) {
return groups.indexOf(e1.group) - groups.indexOf(e2.group); // older groups first
@ -206,7 +206,7 @@ export class AllEditorsPicker extends BaseEditorPicker {
protected getEditorEntries(): EditorPickerEntry[] {
const entries: EditorPickerEntry[] = [];
this.editorGroupService.getGroups(GroupsOrder.CREATION_TIME).forEach(group => {
this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(group => {
group.editors.forEach(editor => {
entries.push(this.instantiationService.createInstance(EditorPickerEntry, editor, group));
});

View file

@ -268,7 +268,7 @@
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
max-width: 260px;
max-width: 80%;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {

View file

@ -108,7 +108,7 @@ export abstract class TitleControl extends Themable {
this.handleBreadcrumbsEnablementChange();
}
}));
if (config.value) {
if (config.value()) {
this.breadcrumbsControl = this.instantiationService.createInstance(BreadcrumbsControl, container, options, this.group);
}
}

View file

@ -49,7 +49,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { Dimension, addClass } from 'vs/base/browser/dom';
import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { timeout } from 'vs/base/common/async';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
@ -684,7 +684,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
@IModelService private modelService: IModelService,
@ITextFileService private textFileService: ITextFileService,
@IConfigurationService private configurationService: IConfigurationService,
@IUriDisplayService uriDisplayService: IUriDisplayService,
@IUriLabelService uriLabelService: IUriLabelService,
@IFileService fileService: IFileService
) {
super(editorService);
@ -700,7 +700,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
const resourceInput = input as IResourceInput;
this.resource = resourceInput.resource;
this.label = resources.basenameOrAuthority(resourceInput.resource);
this.description = uriDisplayService.getLabel(resources.dirname(this.resource), true);
this.description = uriLabelService.getLabel(resources.dirname(this.resource), true);
this.dirty = this.resource && this.textFileService.isDirty(this.resource);
if (this.dirty && this.textFileService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {

View file

@ -30,7 +30,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { RunOnceScheduler } from 'vs/base/common/async';
import { MENUBAR_SELECTION_FOREGROUND, MENUBAR_SELECTION_BACKGROUND, MENUBAR_SELECTION_BORDER, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, MENU_BACKGROUND, MENU_FOREGROUND, MENU_SELECTION_BACKGROUND, MENU_SELECTION_FOREGROUND, MENU_SELECTION_BORDER } from 'vs/workbench/common/theme';
import URI from 'vs/base/common/uri';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { foreground } from 'vs/platform/theme/common/colorRegistry';
import { IUpdateService, StateType } from 'vs/platform/update/common/update';
@ -121,7 +121,7 @@ export class MenubarControl extends Disposable {
@IKeybindingService private keybindingService: IKeybindingService,
@IConfigurationService private configurationService: IConfigurationService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IUriDisplayService private uriDisplayService: IUriDisplayService,
@IUriLabelService private uriLabelService: IUriLabelService,
@IUpdateService private updateService: IUpdateService
) {
@ -507,14 +507,14 @@ export class MenubarControl extends Disposable {
let uri: URI;
if (isSingleFolderWorkspaceIdentifier(workspace) && !isFile) {
label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true });
label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true });
uri = workspace;
} else if (isWorkspaceIdentifier(workspace)) {
label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true });
label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true });
uri = URI.file(workspace.configPath);
} else {
uri = workspace;
label = this.uriDisplayService.getLabel(uri);
label = this.uriLabelService.getLabel(uri);
}
return new Action(commandId, label, undefined, undefined, (event) => {

View file

@ -34,7 +34,7 @@ import { addDisposableListener, EventType, EventHelper, Dimension } from 'vs/bas
import { MenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { template, getBaseLabel } from 'vs/base/common/labels';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { Event } from 'vs/base/common/event';
export class TitlebarPart extends Part implements ITitleService {
@ -84,7 +84,7 @@ export class TitlebarPart extends Part implements ITitleService {
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IInstantiationService private instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super(id, { hasTitle: false }, themeService);
@ -244,9 +244,9 @@ export class TitlebarPart extends Part implements ITitleService {
const activeEditorMedium = editor ? editor.getTitle(Verbosity.MEDIUM) : activeEditorShort;
const activeEditorLong = editor ? editor.getTitle(Verbosity.LONG) : activeEditorMedium;
const rootName = workspace.name;
const rootPath = root ? this.uriDisplayService.getLabel(root) : '';
const rootPath = root ? this.uriLabelService.getLabel(root) : '';
const folderName = folder ? folder.name : '';
const folderPath = folder ? this.uriDisplayService.getLabel(folder.uri) : '';
const folderPath = folder ? this.uriLabelService.getLabel(folder.uri) : '';
const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
const appName = this.environmentService.appNameLong;
const separator = TitlebarPart.TITLE_SEPARATOR;

View file

@ -18,7 +18,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUtils';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
/**
* An editor input to be used for untitled text buffers.
@ -46,7 +46,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
@IInstantiationService private instantiationService: IInstantiationService,
@ITextFileService private textFileService: ITextFileService,
@IHashService private hashService: IHashService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super();
@ -79,17 +79,17 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
@memoize
private get shortDescription(): string {
return paths.basename(this.uriDisplayService.getLabel(resources.dirname(this.resource)));
return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource)));
}
@memoize
private get mediumDescription(): string {
return this.uriDisplayService.getLabel(resources.dirname(this.resource), true);
return this.uriLabelService.getLabel(resources.dirname(this.resource), true);
}
@memoize
private get longDescription(): string {
return this.uriDisplayService.getLabel(resources.dirname(this.resource));
return this.uriLabelService.getLabel(resources.dirname(this.resource));
}
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string {
@ -121,12 +121,12 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
@memoize
private get mediumTitle(): string {
return this.uriDisplayService.getLabel(this.resource, true);
return this.uriLabelService.getLabel(this.resource, true);
}
@memoize
private get longTitle(): string {
return this.uriDisplayService.getLabel(this.resource);
return this.uriLabelService.getLabel(this.resource);
}
getTitle(verbosity: Verbosity): string {

View file

@ -46,7 +46,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Context } from 'vs/platform/contextkey/browser/contextKeyService';
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { dirname } from 'vs/base/common/resources';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
@ -700,7 +700,7 @@ export abstract class BaseOpenRecentAction extends Action {
private quickInputService: IQuickInputService,
private contextService: IWorkspaceContextService,
private environmentService: IEnvironmentService,
private uriDisplayService: IUriDisplayService,
private uriLabelService: IUriLabelService,
private keybindingService: IKeybindingService,
private modelService: IModelService,
private modeService: IModeService,
@ -717,22 +717,22 @@ export abstract class BaseOpenRecentAction extends Action {
private openRecent(recentWorkspaces: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier)[], recentFiles: URI[]): void {
const toPick = (workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI, fileKind: FileKind, environmentService: IEnvironmentService, uriDisplayService: IUriDisplayService, buttons: IQuickInputButton[]) => {
const toPick = (workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI, fileKind: FileKind, environmentService: IEnvironmentService, uriLabelService: IUriLabelService, buttons: IQuickInputButton[]) => {
let resource: URI;
let label: string;
let description: string;
if (isSingleFolderWorkspaceIdentifier(workspace) && fileKind !== FileKind.FILE) {
resource = workspace;
label = getWorkspaceLabel(workspace, environmentService, uriDisplayService);
description = uriDisplayService.getLabel(dirname(resource));
label = getWorkspaceLabel(workspace, environmentService, uriLabelService);
description = uriLabelService.getLabel(dirname(resource));
} else if (isWorkspaceIdentifier(workspace)) {
resource = URI.file(workspace.configPath);
label = getWorkspaceLabel(workspace, environmentService, uriDisplayService);
description = uriDisplayService.getLabel(dirname(resource));
label = getWorkspaceLabel(workspace, environmentService, uriLabelService);
description = uriLabelService.getLabel(dirname(resource));
} else {
resource = workspace;
label = getBaseLabel(workspace);
description = uriDisplayService.getLabel(dirname(resource));
description = uriLabelService.getLabel(dirname(resource));
}
return {
@ -751,8 +751,8 @@ export abstract class BaseOpenRecentAction extends Action {
return this.windowService.openWindow([resource], { forceNewWindow, forceOpenWorkspaceAsFile: isFile });
};
const workspacePicks = recentWorkspaces.map(workspace => toPick(workspace, isSingleFolderWorkspaceIdentifier(workspace) ? FileKind.FOLDER : FileKind.ROOT_FOLDER, this.environmentService, this.uriDisplayService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0));
const filePicks = recentFiles.map(p => toPick(p, FileKind.FILE, this.environmentService, this.uriDisplayService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0));
const workspacePicks = recentWorkspaces.map(workspace => toPick(workspace, isSingleFolderWorkspaceIdentifier(workspace) ? FileKind.FOLDER : FileKind.ROOT_FOLDER, this.environmentService, this.uriLabelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0));
const filePicks = recentFiles.map(p => toPick(p, FileKind.FILE, this.environmentService, this.uriLabelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0));
// focus second entry if the first recent workspace is the current workspace
let autoFocusSecondEntry: boolean = recentWorkspaces[0] && this.contextService.isCurrentWorkspace(recentWorkspaces[0]);
@ -800,9 +800,9 @@ export class OpenRecentAction extends BaseOpenRecentAction {
@IKeybindingService keybindingService: IKeybindingService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@IUriDisplayService uriDisplayService: IUriDisplayService
@IUriLabelService uriLabelService: IUriLabelService
) {
super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriDisplayService, keybindingService, modelService, modeService);
super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService);
}
protected isQuickNavigate(): boolean {
@ -826,9 +826,9 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction {
@IKeybindingService keybindingService: IKeybindingService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@IUriDisplayService uriDisplayService: IUriDisplayService
@IUriLabelService uriLabelService: IUriLabelService
) {
super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriDisplayService, keybindingService, modelService, modeService);
super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService);
}
protected isQuickNavigate(): boolean {
@ -1721,4 +1721,4 @@ export class InspectContextKeysAction extends Action {
return TPromise.as(null);
}
}
}

View file

@ -116,7 +116,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { WorkbenchThemeService } from 'vs/workbench/services/themes/electron-browser/workbenchThemeService';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
interface WorkbenchParams {
configuration: IWindowConfiguration;
@ -337,9 +337,9 @@ export class Workbench extends Disposable implements IPartService {
serviceCollection.set(IClipboardService, new ClipboardService());
// Uri Display
const uriDisplayService = new UriDisplayService(this.environmentService, this.contextService);
serviceCollection.set(IUriDisplayService, uriDisplayService);
this.configurationService.acquireUriDisplayService(uriDisplayService);
const uriLabelService = new UriLabelService(this.environmentService, this.contextService);
serviceCollection.set(IUriLabelService, uriLabelService);
this.configurationService.acquireUriLabelService(uriLabelService);
// Status bar
this.statusbarPart = this.instantiationService.createInstance(StatusbarPart, Identifiers.STATUSBAR_PART);

View file

@ -11,7 +11,7 @@
.suggest-input-container .monaco-editor,
.suggest-input-container .mtk1 {
/* allow the embedded monaco to be styled from the outer context */
background-color: inherit;
background-color: transparent;
color: inherit;
}

View file

@ -299,24 +299,6 @@ export class ReviewZoneWidget extends ZoneWidget {
this._localToDispose.push(this.editor.onMouseDown(e => this.onEditorMouseDown(e)));
this._localToDispose.push(this.editor.onMouseUp(e => this.onEditorMouseUp(e)));
this._localToDispose.push(this.editor.onDidChangeModelContent((e) => {
// If the widget has been opened, the position is set and can be relied on for updating the glyph position
if (this.position) {
if (this.position.lineNumber !== this._commentGlyph.getPosition().position.lineNumber) {
this._commentGlyph.setLineNumber(this.position.lineNumber);
}
} else {
// Otherwise manually calculate position change :(
const positionChange = e.changes.map(change => {
if (change.range.startLineNumber < change.range.endLineNumber) {
return change.range.startLineNumber - change.range.endLineNumber;
} else {
return change.text.split(e.eol).length - 1;
}
}).reduce((prev, curr) => prev + curr, 0);
this._commentGlyph.setLineNumber(this._commentGlyph.getPosition().position.lineNumber + positionChange);
}
}));
var headHeight = Math.ceil(this.editor.getConfiguration().lineHeight * 1.2);
this._headElement.style.height = `${headHeight}px`;
this._headElement.style.lineHeight = this._headElement.style.height;

View file

@ -32,7 +32,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
const $ = dom.$;
@ -296,7 +296,7 @@ class BreakpointsRenderer implements IRenderer<IBreakpoint, IBreakpointTemplateD
constructor(
@IDebugService private debugService: IDebugService,
@IUriDisplayService private uriDisplayService: IUriDisplayService,
@IUriLabelService private uriLabelService: IUriLabelService,
@ITextFileService private textFileService: ITextFileService
) {
// noop
@ -340,7 +340,7 @@ class BreakpointsRenderer implements IRenderer<IBreakpoint, IBreakpointTemplateD
if (breakpoint.column) {
data.lineNumber.textContent += `:${breakpoint.column}`;
}
data.filePath.textContent = this.uriDisplayService.getLabel(resources.dirname(breakpoint.uri), true);
data.filePath.textContent = this.uriLabelService.getLabel(resources.dirname(breakpoint.uri), true);
data.checkbox.checked = breakpoint.enabled;
const { message, className } = getBreakpointMessageAndClassName(this.debugService, this.textFileService, breakpoint);

View file

@ -27,7 +27,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
const $ = dom.$;
@ -398,7 +398,7 @@ class CallStackRenderer implements IRenderer {
constructor(
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
// noop
}
@ -517,7 +517,7 @@ class CallStackRenderer implements IRenderer {
dom.toggleClass(data.stackFrame, 'label', stackFrame.presentationHint === 'label');
dom.toggleClass(data.stackFrame, 'subtle', stackFrame.presentationHint === 'subtle');
data.file.title = stackFrame.source.inMemory ? stackFrame.source.name : this.uriDisplayService.getLabel(stackFrame.source.uri);
data.file.title = stackFrame.source.inMemory ? stackFrame.source.name : this.uriLabelService.getLabel(stackFrame.source.uri);
if (stackFrame.source.raw.origin) {
data.file.title += `\n${stackFrame.source.raw.origin}`;
}

View file

@ -17,6 +17,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { formatPII } from 'vs/workbench/parts/debug/common/debugUtils';
import { SocketDebugAdapter } from 'vs/workbench/parts/debug/node/debugAdapter';
import { SessionState, DebugEvent, IRawSession, IDebugAdapter } from 'vs/workbench/parts/debug/common/debug';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
export interface SessionExitedEvent extends DebugEvent {
@ -44,7 +45,7 @@ export class RawDebugSession implements IRawSession {
private startTime: number;
public disconnected: boolean;
private terminated: boolean;
private sentPromises: TPromise<DebugProtocol.Response>[];
private cancellationTokens: CancellationTokenSource[];
private _capabilities: DebugProtocol.Capabilities;
private allThreadsContinued: boolean;
private state: SessionState = SessionState.LAUNCH;
@ -75,7 +76,7 @@ export class RawDebugSession implements IRawSession {
this.emittedStopped = false;
this.readyForBreakpoints = false;
this.allThreadsContinued = true;
this.sentPromises = [];
this.cancellationTokens = [];
this._onDidInitialize = new Emitter<DebugProtocol.InitializedEvent>();
this._onDidStop = new Emitter<DebugProtocol.StoppedEvent>();
@ -182,7 +183,8 @@ export class RawDebugSession implements IRawSession {
private send<R extends DebugProtocol.Response>(command: string, args: any, cancelOnDisconnect = true): TPromise<R> {
return this.initServer().then(() => {
const promise = this.internalSend<R>(command, args).then(response => response, (errorResponse: DebugProtocol.ErrorResponse) => {
const cancellationSource = new CancellationTokenSource();
const promise = this.internalSend<R>(command, args, cancellationSource.token).then(response => response, (errorResponse: DebugProtocol.ErrorResponse) => {
const error = errorResponse && errorResponse.body ? errorResponse.body.error : null;
const errorMessage = errorResponse ? errorResponse.message : '';
const telemetryMessage = error ? formatPII(error.format, true, error.variables) : errorMessage;
@ -217,16 +219,15 @@ export class RawDebugSession implements IRawSession {
});
if (cancelOnDisconnect) {
this.sentPromises.push(promise);
this.cancellationTokens.push(cancellationSource);
}
return promise;
});
}
private internalSend<R extends DebugProtocol.Response>(command: string, args: any): TPromise<R> {
let errorCallback: (error: Error) => void;
private internalSend<R extends DebugProtocol.Response>(command: string, args: any, cancelationToken: CancellationToken): TPromise<R> {
return new TPromise<R>((completeDispatch, errorDispatch) => {
errorCallback = errorDispatch;
cancelationToken.onCancellationRequested(() => errorDispatch(errors.canceled()));
this.debugAdapter.sendRequest(command, args, (result: R) => {
if (result.success) {
completeDispatch(result);
@ -234,7 +235,7 @@ export class RawDebugSession implements IRawSession {
errorDispatch(result);
}
});
}, () => errorCallback(errors.canceled()));
});
}
private onDapEvent(event: DebugEvent): void {
@ -495,8 +496,8 @@ export class RawDebugSession implements IRawSession {
// Cancel all sent promises on disconnect so debug trees are not left in a broken state #3666.
// Give a 1s timeout to give a chance for some promises to complete.
setTimeout(() => {
this.sentPromises.forEach(p => p && p.cancel());
this.sentPromises = [];
this.cancellationTokens.forEach(token => token.cancel());
this.cancellationTokens = [];
}, 1000);
if (this.debugAdapter && !this.disconnected) {

View file

@ -24,7 +24,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { LinkDetector } from 'vs/workbench/parts/debug/browser/linkDetector';
import { handleANSIOutput } from 'vs/workbench/parts/debug/browser/debugANSIHandling';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
const $ = dom.$;
@ -97,7 +97,7 @@ export class ReplExpressionsRenderer implements IRenderer {
constructor(
@IEditorService private editorService: IEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
this.linkDetector = this.instantiationService.createInstance(LinkDetector);
}
@ -260,7 +260,7 @@ export class ReplExpressionsRenderer implements IRenderer {
dom.addClass(templateData.value, (element.severity === severity.Warning) ? 'warn' : (element.severity === severity.Error) ? 'error' : (element.severity === severity.Ignore) ? 'ignore' : 'info');
templateData.source.textContent = element.sourceData ? `${element.sourceData.source.name}:${element.sourceData.lineNumber}` : '';
templateData.source.title = element.sourceData ? this.uriDisplayService.getLabel(element.sourceData.source.uri) : '';
templateData.source.title = element.sourceData ? this.uriLabelService.getLabel(element.sourceData.source.uri) : '';
templateData.getReplElementSource = () => element.sourceData;
}

View file

@ -8,6 +8,7 @@ import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAction, Action } from 'vs/base/common/actions';
import { Throttler } from 'vs/base/common/async';
import severity from 'vs/base/common/severity';
import * as DOM from 'vs/base/browser/dom';
import * as paths from 'vs/base/common/paths';
import { Event } from 'vs/base/common/event';
@ -756,18 +757,37 @@ export class DisableAction extends Action {
export class CheckForUpdatesAction extends Action {
static readonly ID = 'workbench.extensions.action.checkForUpdates';
static LABEL = localize('checkForUpdates', "Check for Updates");
static LABEL = localize('checkForUpdates', "Check for Extension Updates");
constructor(
id = UpdateAllAction.ID,
label = UpdateAllAction.LABEL,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService
id = CheckForUpdatesAction.ID,
label = CheckForUpdatesAction.LABEL,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IViewletService private viewletService: IViewletService,
@INotificationService private notificationService: INotificationService
) {
super(id, label, '', true);
}
private checkUpdatesAndNotify(): void {
this.extensionsWorkbenchService.queryLocal().then(
extensions => {
const outdatedCount = extensions.filter(ext => ext.outdated === true).length;
let msgAvailableExtensions = localize('noUpdatesAvailable', "All Extensions are up to date.");
if (outdatedCount > 0) {
msgAvailableExtensions = outdatedCount === 1 ? localize('updateAvailable', "An Extension update is available.")
: localize('updatesAvailable', "{0} extensions updates are available.", outdatedCount);
this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => viewlet.search(''));
}
this.notificationService.notify({ severity: severity.Info, message: msgAvailableExtensions });
}
);
}
run(): TPromise<any> {
return this.extensionsWorkbenchService.checkForUpdates();
return this.extensionsWorkbenchService.checkForUpdates().then(() => this.checkUpdatesAndNotify());
}
}

View file

@ -82,7 +82,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
if (configuration.workbench && configuration.workbench.editor && typeof configuration.workbench.editor.closeOnFileDelete === 'boolean') {
this.closeOnFileDelete = configuration.workbench.editor.closeOnFileDelete;
} else {
this.closeOnFileDelete = true; // default
this.closeOnFileDelete = false; // default
}
}
@ -148,7 +148,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
// Do NOT close any opened editor that matches the resource path (either equal or being parent) of the
// resource we move to (movedTo). Otherwise we would close a resource that has been renamed to the same
// path but different casing.
if (movedTo && resources.isEqualOrParent(resource, movedTo, resources.hasToIgnoreCase(resource)) && resource.path.indexOf(movedTo.path) === 0) {
if (movedTo && resources.isEqualOrParent(resource, movedTo, resources.hasToIgnoreCase(resource))) {
return;
}
@ -218,9 +218,9 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
private handleMovedFileInOpenedEditors(oldResource: URI, newResource: URI): void {
this.editorGroupService.groups.forEach(group => {
group.editors.forEach(input => {
if (input instanceof FileEditorInput) {
const resource = input.getResource();
group.editors.forEach(editor => {
if (editor instanceof FileEditorInput) {
const resource = editor.getResource();
// Update Editor if file (or any parent of the input) got renamed or moved
if (resources.isEqualOrParent(resource, oldResource, resources.hasToIgnoreCase(resource))) {
@ -232,17 +232,19 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
reopenFileResource = resources.joinPath(newResource, resource.path.substr(index + oldResource.path.length + 1)); // parent folder got moved
}
// Reopen
this.editorService.openEditor({
resource: reopenFileResource,
options: {
preserveFocus: true,
pinned: group.isPinned(input),
index: group.getIndexOfEditor(input),
inactive: !group.isActive(input),
viewState: this.getViewStateFor(oldResource, group)
}
}, group);
this.editorService.replaceEditors([{
editor: { resource },
replacement: {
resource: reopenFileResource,
options: {
preserveFocus: true,
pinned: group.isPinned(editor),
index: group.getIndexOfEditor(editor),
inactive: !group.isActive(editor),
viewState: this.getViewStateFor(oldResource, group)
}
},
}], group);
}
}
});

View file

@ -21,7 +21,7 @@ import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUt
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { FILE_EDITOR_INPUT_ID, TEXT_FILE_EDITOR_ID, BINARY_FILE_EDITOR_ID } from 'vs/workbench/parts/files/common/files';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
/**
* A file editor input is the input type for the file editor of file system resources.
@ -43,7 +43,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
@ITextFileService private textFileService: ITextFileService,
@ITextModelService private textModelResolverService: ITextModelService,
@IHashService private hashService: IHashService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super();
@ -132,17 +132,17 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
@memoize
private get shortDescription(): string {
return paths.basename(this.uriDisplayService.getLabel(resources.dirname(this.resource)));
return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource)));
}
@memoize
private get mediumDescription(): string {
return this.uriDisplayService.getLabel(resources.dirname(this.resource), true);
return this.uriLabelService.getLabel(resources.dirname(this.resource), true);
}
@memoize
private get longDescription(): string {
return this.uriDisplayService.getLabel(resources.dirname(this.resource), true);
return this.uriLabelService.getLabel(resources.dirname(this.resource), true);
}
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string {
@ -170,12 +170,12 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
@memoize
private get mediumTitle(): string {
return this.uriDisplayService.getLabel(this.resource, true);
return this.uriLabelService.getLabel(this.resource, true);
}
@memoize
private get longTitle(): string {
return this.uriDisplayService.getLabel(this.resource, true);
return this.uriLabelService.getLabel(this.resource, true);
}
getTitle(verbosity: Verbosity): string {

View file

@ -34,7 +34,7 @@ import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInpu
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { Schemas } from 'vs/base/common/network';
import { nativeSep } from 'vs/base/common/paths';
@ -53,10 +53,10 @@ export class OpenExplorerViewletAction extends ToggleViewletAction {
}
}
class FileUriDisplayContribution implements IWorkbenchContribution {
class FileUriLabelContribution implements IWorkbenchContribution {
constructor(@IUriDisplayService uriDisplayService: IUriDisplayService) {
uriDisplayService.registerFormater(Schemas.file, {
constructor(@IUriLabelService uriLabelService: IUriLabelService) {
uriLabelService.registerFormater(Schemas.file, {
label: '${path}',
separator: nativeSep,
tildify: !platform.isWindows,
@ -172,7 +172,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DirtyFilesTracker, LifecyclePhase.Starting);
// Register uri display for file uris
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileUriDisplayContribution, LifecyclePhase.Starting);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileUriLabelContribution, LifecyclePhase.Starting);
// Configuration

View file

@ -10,7 +10,7 @@ import { IAction, ActionRunner } from 'vs/base/common/actions';
import * as dom from 'vs/base/browser/dom';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IEditorGroupsService, IEditorGroup, GroupChangeKind } from 'vs/workbench/services/group/common/editorGroupsService';
import { IEditorGroupsService, IEditorGroup, GroupChangeKind, GroupsOrder } from 'vs/workbench/services/group/common/editorGroupsService';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorInput } from 'vs/workbench/common/editor';
@ -326,7 +326,7 @@ export class OpenEditorsView extends ViewletPanel {
private get elements(): (IEditorGroup | OpenEditor)[] {
const result: (IEditorGroup | OpenEditor)[] = [];
this.editorGroupService.groups.forEach(g => {
this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(g => {
if (this.showGroups) {
result.push(g);
}
@ -342,7 +342,7 @@ export class OpenEditorsView extends ViewletPanel {
return index;
}
for (let g of this.editorGroupService.groups) {
for (let g of this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE)) {
if (g.id === group.id) {
return index + (!!editor ? 1 : 0);
} else {

View file

@ -13,7 +13,7 @@ import { join } from 'vs/base/common/paths';
import URI from 'vs/base/common/uri';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { language } from 'vs/base/common/platform';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export class ConfigureLocaleAction extends Action {
public static readonly ID = 'workbench.action.configureLocale';
@ -32,7 +32,7 @@ export class ConfigureLocaleAction extends Action {
@IFileService private fileService: IFileService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IEditorService private editorService: IEditorService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super(id, label);
}
@ -49,7 +49,7 @@ export class ConfigureLocaleAction extends Action {
resource: stat.resource
});
}, (error) => {
throw new Error(localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriDisplayService.getLabel(file, true), error));
throw new Error(localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(file, true), error));
});
}
}

View file

@ -121,7 +121,8 @@ export class Marker extends NodeWithId {
constructor(
id: string,
readonly raw: IMarker
readonly raw: IMarker,
readonly resourceMarkers: ResourceMarkers
) {
super(id);
}
@ -314,7 +315,7 @@ export class MarkersModel {
this.updateResource(resource);
rawMarkers.forEach((rawMarker, index) => {
const marker = new Marker(uri.toString() + index, rawMarker);
const marker = new Marker(uri.toString() + index, rawMarker, resource);
if (rawMarker.relatedInformation) {
const groupedByResource = groupBy(rawMarker.relatedInformation, MarkersModel._compareMarkersByUri);
groupedByResource.sort((a, b) => compareUris(a[0].resource, b[0].resource));

View file

@ -30,7 +30,7 @@ import { localize } from 'vs/nls';
import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ContextScopedHistoryInputBox } from 'vs/platform/widget/browser/contextScopedHistoryWidget';
import { Marker, ResourceMarkers } from 'vs/workbench/parts/markers/electron-browser/markersModel';
import { Marker } from 'vs/workbench/parts/markers/electron-browser/markersModel';
import { applyCodeAction } from 'vs/editor/contrib/codeAction/codeActionCommands';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { ICommandService } from 'vs/platform/commands/common/commands';
@ -282,17 +282,16 @@ export class QuickFixAction extends Action {
constructor(
readonly marker: Marker,
readonly resourceMarkers: ResourceMarkers,
@IBulkEditService private bulkEditService: IBulkEditService,
@ICommandService private commandService: ICommandService,
@IEditorService private editorService: IEditorService
) {
super(QuickFixAction.ID, Messages.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX, 'markers-panel-action-quickfix', false);
resourceMarkers.hasFixes(marker).then(hasFixes => this.enabled = hasFixes);
marker.resourceMarkers.hasFixes(marker).then(hasFixes => this.enabled = hasFixes);
}
async getQuickFixActions(): Promise<IAction[]> {
const codeActions = await this.resourceMarkers.getFixes(this.marker);
const codeActions = await this.marker.resourceMarkers.getFixes(this.marker);
return codeActions.map(codeAction => new Action(
codeAction.command ? codeAction.command.id : codeAction.title,
codeAction.title,

View file

@ -7,7 +7,7 @@
import { TPromise } from 'vs/base/common/winjs.base';
import * as mouse from 'vs/base/browser/mouseEvent';
import * as tree from 'vs/base/parts/tree/browser/tree';
import { MarkersModel, Marker, ResourceMarkers } from 'vs/workbench/parts/markers/electron-browser/markersModel';
import { MarkersModel, Marker } from 'vs/workbench/parts/markers/electron-browser/markersModel';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
import { IAction } from 'vs/base/common/actions';
@ -76,14 +76,11 @@ export class Controller extends WorkbenchTreeController {
const result: IAction[] = [];
if (element instanceof Marker) {
const parent = tree.getNavigator(element).parent();
if (parent instanceof ResourceMarkers) {
const quickFixAction = this.instantiationService.createInstance(QuickFixAction, element, parent);
const quickFixActions = await quickFixAction.getQuickFixActions();
if (quickFixActions.length) {
result.push(...quickFixActions);
result.push(new Separator());
}
const quickFixAction = this.instantiationService.createInstance(QuickFixAction, element);
const quickFixActions = await quickFixAction.getQuickFixActions();
if (quickFixActions.length) {
result.push(...quickFixActions);
result.push(new Separator());
}
}

View file

@ -21,7 +21,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ActionBar, IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { QuickFixAction } from 'vs/workbench/parts/markers/electron-browser/markersPanelActions';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
interface IResourceMarkersTemplateData {
resourceLabel: ResourceLabel;
@ -99,7 +99,7 @@ export class Renderer implements IRenderer {
private actionItemProvider: IActionItemProvider,
@IInstantiationService private instantiationService: IInstantiationService,
@IThemeService private themeService: IThemeService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
}
@ -208,7 +208,7 @@ export class Renderer implements IRenderer {
if (templateData.resourceLabel instanceof FileLabel) {
templateData.resourceLabel.setFile(element.uri, { matches: element.uriMatches });
} else {
templateData.resourceLabel.setLabel({ name: element.name, description: this.uriDisplayService.getLabel(element.uri, true), resource: element.uri }, { matches: element.uriMatches });
templateData.resourceLabel.setLabel({ name: element.name, description: this.uriLabelService.getLabel(element.uri, true), resource: element.uri }, { matches: element.uriMatches });
}
(<IResourceMarkersTemplateData>templateData).count.setCount(element.filteredCount);
}
@ -222,8 +222,7 @@ export class Renderer implements IRenderer {
dom.toggleClass(templateData.source.element, 'marker-source', !!marker.source);
templateData.actionBar.clear();
const resourceMarkers: ResourceMarkers = tree.getNavigator(element).parent();
const quickFixAction = this.instantiationService.createInstance(QuickFixAction, element, resourceMarkers);
const quickFixAction = this.instantiationService.createInstance(QuickFixAction, element);
templateData.actionBar.push([quickFixAction], { icon: true, label: false });
templateData.description.set(marker.message, element.messageMatches);
@ -235,7 +234,7 @@ export class Renderer implements IRenderer {
private renderRelatedInfoElement(tree: ITree, element: RelatedInformation, templateData: IRelatedInformationTemplateData) {
templateData.resourceLabel.set(paths.basename(element.raw.resource.fsPath), element.uriMatches);
templateData.resourceLabel.element.title = this.uriDisplayService.getLabel(element.raw.resource, true);
templateData.resourceLabel.element.title = this.uriLabelService.getLabel(element.raw.resource, true);
templateData.lnCol.textContent = Messages.MARKERS_PANEL_AT_LINE_COL_NUMBER(element.raw.startLineNumber, element.raw.startColumn);
templateData.description.set(element.raw.message, element.messageMatches);
templateData.description.element.title = element.raw.message;
@ -272,13 +271,13 @@ export class Renderer implements IRenderer {
export class MarkersTreeAccessibilityProvider implements IAccessibilityProvider {
constructor(
@IUriDisplayService private uriDisplayServie: IUriDisplayService
@IUriLabelService private uriLabelServie: IUriLabelService
) {
}
public getAriaLabel(tree: ITree, element: any): string {
if (element instanceof ResourceMarkers) {
const path = this.uriDisplayServie.getLabel(element.uri, true) || element.uri.fsPath;
const path = this.uriLabelServie.getLabel(element.uri, true) || element.uri.fsPath;
return Messages.MARKERS_TREE_ARIA_LABEL_RESOURCE(element.filteredCount, element.name, paths.dirname(path));
}
if (element instanceof Marker) {

View file

@ -140,19 +140,19 @@ suite('MarkersModel Test', () => {
test('toString()', function () {
let marker = aMarker('a/res1');
marker.code = '1234';
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker).toString());
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker, null).toString());
marker = aMarker('a/res2', MarkerSeverity.Warning);
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker).toString());
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker, null).toString());
marker = aMarker('a/res2', MarkerSeverity.Info, 1, 2, 1, 8, 'Info', '');
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker).toString());
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker, null).toString());
marker = aMarker('a/res2', MarkerSeverity.Hint, 1, 2, 1, 8, 'Ignore message', 'Ignore');
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker).toString());
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path }, null, '\t'), instantiationService.createInstance(Marker, '', marker, null).toString());
marker = aMarker('a/res2', MarkerSeverity.Warning, 1, 2, 1, 8, 'Warning message', '', [{ startLineNumber: 2, startColumn: 5, endLineNumber: 2, endColumn: 10, message: 'some info', resource: URI.file('a/res3') }]);
const testObject = instantiationService.createInstance(Marker, '', marker);
const testObject = instantiationService.createInstance(Marker, '', marker, null);
testObject.resourceRelatedInformation = marker.relatedInformation.map(r => new RelatedInformation('', r));
assert.equal(JSON.stringify({ ...marker, resource: marker.resource.path, relatedInformation: marker.relatedInformation.map(r => ({ ...r, resource: r.resource.path })) }, null, '\t'), testObject.toString());
});

View file

@ -244,13 +244,6 @@
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-deprecation-message,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description {
margin-top: 3px;
overflow: hidden;
text-overflow: ellipsis;
height: 18px;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
transform: translate3d(0px, 0px, 0px);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-deprecation-message {
@ -278,6 +271,11 @@
width: 200px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-number input[type=number]::-webkit-inner-spin-button {
/* Hide arrow button that shows in type=number fields */
-webkit-appearance: none !important;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description-markdown * {
margin: 0px;
}
@ -297,17 +295,16 @@
visibility: hidden;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-description,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {
height: initial;
-webkit-line-clamp: initial;
.settings-editor.search-mode > .settings-body > .settings-tree-container .setting-measure-container.measure-bool-description .setting-item-description {
/* Allocate space for the checkbox control */
margin-left: 27px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-enumDescription {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-enumDescription,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-enumDescription,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-enumDescription {
display: block;
}

View file

@ -45,13 +45,13 @@ export class OpenSettings2Action extends Action {
constructor(
id: string,
label: string,
@IPreferencesService private preferencesService2: IPreferencesService
@IPreferencesService private preferencesService: IPreferencesService
) {
super(id, label);
}
public run(event?: any): TPromise<any> {
return this.preferencesService2.openSettings2();
return this.preferencesService.openSettings(false);
}
}
@ -71,9 +71,8 @@ export class OpenSettingsAction extends Action {
}
public run(event?: any): TPromise<any> {
return this.configurationService.getValue('workbench.settings.editor') === 'json' ?
this.preferencesService.openSettings() :
this.preferencesService.openSettings2();
const jsonEditorPreferred = this.configurationService.getValue('workbench.settings.editor') === 'json';
return this.preferencesService.openSettings(jsonEditorPreferred);
}
}
@ -91,7 +90,7 @@ export class OpenSettingsJsonAction extends Action {
}
public run(event?: any): TPromise<any> {
return this.preferencesService.openSettings();
return this.preferencesService.openSettings(true);
}
}
@ -110,9 +109,8 @@ export class OpenGlobalSettingsAction extends Action {
}
public run(event?: any): TPromise<any> {
return this.configurationService.getValue('workbench.settings.editor') === 'json' ?
this.preferencesService.openGlobalSettings() :
this.preferencesService.openSettings2();
const jsonEditorPreferred = this.configurationService.getValue('workbench.settings.editor') === 'json';
return this.preferencesService.openGlobalSettings(jsonEditorPreferred);
}
}
@ -194,9 +192,8 @@ export class OpenWorkspaceSettingsAction extends Action {
}
public run(event?: any): TPromise<any> {
return this.configurationService.getValue('workbench.settings.editor') === 'json' ?
this.preferencesService.openWorkspaceSettings() :
this.preferencesService.openSettings2();
const jsonEditorPreferred = this.configurationService.getValue('workbench.settings.editor') === 'json';
return this.preferencesService.openWorkspaceSettings(jsonEditorPreferred);
}
public dispose(): void {
@ -234,17 +231,15 @@ export class OpenFolderSettingsAction extends Action {
}
public run(): TPromise<any> {
if (this.configurationService.getValue('workbench.settings.editor') === 'json') {
return this.commandService.executeCommand<IWorkspaceFolder>(PICK_WORKSPACE_FOLDER_COMMAND_ID)
.then(workspaceFolder => {
if (workspaceFolder) {
return this.commandService.executeCommand(OPEN_FOLDER_SETTINGS_COMMAND, workspaceFolder.uri);
}
return null;
});
} else {
return this.preferencesService.openSettings2();
}
return this.commandService.executeCommand<IWorkspaceFolder>(PICK_WORKSPACE_FOLDER_COMMAND_ID)
.then(workspaceFolder => {
if (workspaceFolder) {
const jsonEditorPreferred = this.configurationService.getValue('workbench.settings.editor') === 'json';
return this.preferencesService.openFolderSettings(workspaceFolder.uri, jsonEditorPreferred);
}
return null;
});
}
public dispose(): void {

View file

@ -120,7 +120,7 @@ export class PreferencesEditor extends BaseEditor {
});
openSettings2Button.label = nls.localize('openSettings2Label', "new settings editor");
openSettings2Button.element.classList.add('open-settings2-button');
this._register(openSettings2Button.onDidClick(() => this.preferencesService.openSettings2()));
this._register(openSettings2Button.onDidClick(() => this.preferencesService.openSettings(false)));
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, this.headerContainer, {
ariaLabel: nls.localize('SearchSettingsWidget.AriaLabel', "Search settings"),
@ -263,11 +263,11 @@ export class PreferencesEditor extends BaseEditor {
const promise = this.input && this.input.isDirty() ? this.input.save() : TPromise.as(true);
promise.done(value => {
if (target === ConfigurationTarget.USER) {
this.preferencesService.switchSettings(ConfigurationTarget.USER, this.preferencesService.userSettingsResource);
this.preferencesService.switchSettings(ConfigurationTarget.USER, this.preferencesService.userSettingsResource, true);
} else if (target === ConfigurationTarget.WORKSPACE) {
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE, this.preferencesService.workspaceSettingsResource);
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE, this.preferencesService.workspaceSettingsResource, true);
} else if (target instanceof URI) {
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE_FOLDER, target);
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE_FOLDER, target, true);
}
});
}

View file

@ -43,12 +43,14 @@ import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsSer
import { IPreferencesService, ISearchResult, ISettingsEditorModel } from 'vs/workbench/services/preferences/common/preferences';
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
const $ = DOM.$;
export class SettingsEditor2 extends BaseEditor {
public static readonly ID: string = 'workbench.editor.settings2';
private static NUM_INSTANCES: number = 0;
private static readonly SUGGESTIONS: string[] = [
'@modified', '@tag:usesOnlineServices', '@tag:new'
@ -110,8 +112,8 @@ export class SettingsEditor2 extends BaseEditor {
) {
super(SettingsEditor2.ID, telemetryService, themeService);
this.delayedFilterLogging = new Delayer<void>(1000);
this.localSearchDelayer = new Delayer(100);
this.remoteSearchThrottle = new ThrottledDelayer(200);
this.localSearchDelayer = new Delayer(300);
this.remoteSearchThrottle = new ThrottledDelayer(400);
this.viewState = { settingsTarget: ConfigurationTarget.USER };
this.delayRefreshOnLayout = new Delayer(100);
@ -216,7 +218,7 @@ export class SettingsEditor2 extends BaseEditor {
provideResults: (query: string) => {
return SettingsEditor2.SUGGESTIONS.filter(tag => query.indexOf(tag) === -1).map(tag => tag + ' ');
}
}, searchBoxLabel, 'settingseditor:searchinput', {
}, searchBoxLabel, 'settingseditor:searchinput' + SettingsEditor2.NUM_INSTANCES++, {
placeholderText: searchBoxLabel,
focusContextKey: this.searchFocusContextKey,
// TODO: Aria-live
@ -228,12 +230,15 @@ export class SettingsEditor2 extends BaseEditor {
const targetWidgetContainer = DOM.append(headerControlsContainer, $('.settings-target-container'));
this.settingsTargetsWidget = this._register(this.instantiationService.createInstance(SettingsTargetsWidget, targetWidgetContainer));
this.settingsTargetsWidget.settingsTarget = ConfigurationTarget.USER;
this.settingsTargetsWidget.onDidTargetChange(() => {
this.viewState.settingsTarget = this.settingsTargetsWidget.settingsTarget;
this.toolbar.context = <ISettingsToolbarContext>{ target: this.settingsTargetsWidget.settingsTarget };
this.settingsTreeModel.update();
this.renderTree();
this.settingsTargetsWidget.onDidTargetChange(target => {
this.viewState.settingsTarget = target;
if (target === ConfigurationTarget.USER) {
this.preferencesService.openGlobalSettings();
} else if (target === ConfigurationTarget.WORKSPACE) {
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE, this.preferencesService.workspaceSettingsResource);
} else if (target instanceof URI) {
this.preferencesService.switchSettings(ConfigurationTarget.WORKSPACE_FOLDER, target);
}
});
this.createHeaderControls(headerControlsContainer);
@ -480,7 +485,7 @@ export class SettingsEditor2 extends BaseEditor {
// Force a render afterwards because onDidConfigurationUpdate doesn't fire if the update doesn't result in an effective setting value change
const settingsTarget = this.settingsTargetsWidget.settingsTarget;
const resource = URI.isUri(settingsTarget) ? settingsTarget : undefined;
const configurationTarget = <ConfigurationTarget>(resource ? undefined : settingsTarget);
const configurationTarget = <ConfigurationTarget>(resource ? ConfigurationTarget.WORKSPACE_FOLDER : settingsTarget);
const overrides: IConfigurationOverrides = { resource };
// If the user is changing the value back to the default, do a 'reset' instead
@ -567,13 +572,15 @@ export class SettingsEditor2 extends BaseEditor {
private render(token: CancellationToken): TPromise<any> {
if (this.input) {
return this.input.resolve()
.then((model: DefaultSettingsEditorModel) => {
.then(model => {
if (token.isCancellationRequested) {
return void 0;
}
this._register(model.onDidChangeGroups(() => this.onConfigUpdate()));
this.defaultSettingsEditorModel = model;
return this.preferencesService.createPreferencesEditorModel((<ResourceEditorModel>model).textEditorModel.uri);
}).then((defaultSettingsEditorModel: DefaultSettingsEditorModel) => {
this._register(defaultSettingsEditorModel.onDidChangeGroups(() => this.onConfigUpdate()));
this.defaultSettingsEditorModel = defaultSettingsEditorModel;
return this.onConfigUpdate();
});
}
@ -690,9 +697,14 @@ export class SettingsEditor2 extends BaseEditor {
}
let refreshP: TPromise<any>;
const elements = key && this.getElementsByKey(key);
if (elements && elements.length) {
refreshP = TPromise.join(elements.map(e => this.settingsTree.refresh(e)));
if (key) {
const elements = this.getElementsByKey(key);
if (elements && elements.length) {
refreshP = TPromise.join(elements.map(e => this.settingsTree.refresh(e)));
} else {
// Refresh requested for a key that we don't know about
return TPromise.wrap(null);
}
} else {
refreshP = this.settingsTree.refresh();
}
@ -895,7 +907,7 @@ export class SettingsEditor2 extends BaseEditor {
}
private layoutTrees(dimension: DOM.Dimension): void {
const listHeight = dimension.height - (DOM.getDomNodePagePosition(this.headerContainer).height + 11 /*padding*/);
const listHeight = dimension.height - (95 + 11 /* header height + padding*/);
const settingsTreeHeight = listHeight - 14;
this.settingsTreeContainer.style.height = `${settingsTreeHeight}px`;
this.settingsTree.layout(settingsTreeHeight, 800);
@ -945,11 +957,11 @@ class OpenSettingsAction extends Action {
private _run(context?: ISettingsToolbarContext): TPromise<any> {
const target = context && context.target;
if (target === ConfigurationTarget.USER) {
return this.preferencesService.openGlobalSettings();
return this.preferencesService.openGlobalSettings(true);
} else if (target === ConfigurationTarget.WORKSPACE) {
return this.preferencesService.openWorkspaceSettings();
return this.preferencesService.openWorkspaceSettings(true);
} else if (URI.isUri(target)) {
return this.preferencesService.openFolderSettings(target);
return this.preferencesService.openFolderSettings(target, true);
}
return TPromise.wrap(null);

View file

@ -197,3 +197,16 @@ export const tocData: ITOCEntry = {
}
]
};
export const knownAcronyms = new Set();
[
'css',
'html',
'scss',
'less',
'json',
'js',
'ts',
'ie',
'id',
].forEach(str => knownAcronyms.add(str));

View file

@ -274,8 +274,9 @@ export class SettingsRenderer implements ITreeRenderer {
private readonly _onDidFocusSetting: Emitter<SettingsTreeSettingElement> = new Emitter<SettingsTreeSettingElement>();
public readonly onDidFocusSetting: Event<SettingsTreeSettingElement> = this._onDidFocusSetting.event;
private measureContainer: HTMLElement;
private measureTemplatesPool = new Map<string, ISettingItemTemplate>();
private descriptionMeasureContainer: HTMLElement;
private longestSingleLineDescription = 0;
private rowHeightCache = new Map<string, number>();
private lastRenderedWidth: number;
@ -287,7 +288,11 @@ export class SettingsRenderer implements ITreeRenderer {
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ICommandService private readonly commandService: ICommandService,
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
this.descriptionMeasureContainer = $('.setting-item-description');
DOM.append(_measureContainer,
$('.setting-measure-container.monaco-tree-row', undefined,
$('.setting-item', undefined,
this.descriptionMeasureContainer)));
}
updateWidth(width: number): void {
@ -338,19 +343,44 @@ export class SettingsRenderer implements ITreeRenderer {
}
private measureSettingElementHeight(tree: ITree, element: SettingsTreeSettingElement): number {
const templateId = this.getTemplateId(tree, element);
const template: ISettingItemTemplate = this.measureTemplatesPool.get(templateId) || this.renderTemplate(tree, templateId, $('.setting-measure-helper')) as ISettingItemTemplate;
this.measureTemplatesPool.set(templateId, template);
this.renderElement(tree, element, templateId, template);
let heightExcludingDescription = 86;
this.measureContainer.appendChild(template.containerElement);
const height = this.measureContainer.offsetHeight;
this.measureContainer.removeChild(this.measureContainer.firstChild);
return height;
if (element.valueType === 'boolean') {
heightExcludingDescription = 60;
}
return heightExcludingDescription + this.measureSettingDescription(element);
}
private measureSettingDescription(element: SettingsTreeSettingElement): number {
if (element.description.length < this.longestSingleLineDescription * .8) {
// Most setting descriptions are one short line, so try to avoid measuring them.
// If the description is less than 80% of the longest single line description, assume this will also render to be one line.
return 18;
}
const boolMeasureClass = 'measure-bool-description';
if (element.valueType === 'boolean') {
this.descriptionMeasureContainer.classList.add(boolMeasureClass);
} else if (this.descriptionMeasureContainer.classList.contains(boolMeasureClass)) {
this.descriptionMeasureContainer.classList.remove(boolMeasureClass);
}
// Remove markdown links and setting links
const measureText = element.description
.replace(/\[(.*)\]\(.*\)/g, '$1')
.replace(/`#(.*)#`/g, '$1');
this.descriptionMeasureContainer.innerText = measureText;
const h = this.descriptionMeasureContainer.offsetHeight;
if (h < 20 && measureText.length > this.longestSingleLineDescription) {
this.longestSingleLineDescription = measureText.length;
}
return h;
}
getTemplateId(tree: ITree, element: SettingsTreeElement): string {
if (element instanceof SettingsTreeGroupElement) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
@ -520,7 +550,7 @@ export class SettingsRenderer implements ITreeRenderer {
const common = this.renderCommonTemplate(tree, container, 'number');
const validationErrorMessageElement = DOM.append(container, $('.setting-item-validation-message'));
const inputBox = new InputBox(common.controlElement, this.contextViewService);
const inputBox = new InputBox(common.controlElement, this.contextViewService, { type: 'number' });
common.toDispose.push(inputBox);
common.toDispose.push(attachInputBoxStyler(inputBox, this.themeService, {
inputBackground: settingsNumberInputBackground,

View file

@ -9,7 +9,7 @@ import URI from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ITOCEntry } from 'vs/workbench/parts/preferences/browser/settingsLayout';
import { ITOCEntry, knownAcronyms } from 'vs/workbench/parts/preferences/browser/settingsLayout';
import { IExtensionSetting, ISearchResult, ISetting } from 'vs/workbench/services/preferences/common/preferences';
import { isArray } from 'vs/base/common/types';
@ -288,7 +288,12 @@ function wordifyKey(key: string): string {
return key
.replace(/\.([a-z])/g, (match, p1) => ` ${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
.replace(/^[a-z]/g, match => match.toUpperCase()) // foo => Foo
.replace(/\b\w+\b/g, match => {
return knownAcronyms.has(match.toLowerCase()) ?
match.toUpperCase() :
match;
});
}
function trimCategoryForGroup(category: string, groupId: string): string {

View file

@ -133,6 +133,7 @@ export class TOCRenderer implements IRenderer {
DOM.toggleClass(template.labelElement, 'no-results', count === 0);
template.labelElement.textContent = label;
template.labelElement.title = label;
if (count) {
template.countElement.textContent = ` (${count})`;

View file

@ -82,7 +82,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
// Global User Settings File
if (isEqual(resource, URI.file(this.environmentService.appSettingsPath), !isLinux)) {
return { override: this.preferencesService.openGlobalSettings(options, group) };
return { override: this.preferencesService.openGlobalSettings(true, options, group) };
}
// Single Folder Workspace Settings File
@ -90,7 +90,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
if (state === WorkbenchState.FOLDER) {
const folders = this.workspaceService.getWorkspace().folders;
if (isEqual(resource, folders[0].toResource(FOLDER_SETTINGS_PATH), hasToIgnoreCase(resource))) {
return { override: this.preferencesService.openWorkspaceSettings(options, group) };
return { override: this.preferencesService.openWorkspaceSettings(true, options, group) };
}
}
@ -99,7 +99,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
const folders = this.workspaceService.getWorkspace().folders;
for (let i = 0; i < folders.length; i++) {
if (isEqual(resource, folders[i].toResource(FOLDER_SETTINGS_PATH), hasToIgnoreCase(resource))) {
return { override: this.preferencesService.openFolderSettings(folders[i].uri, options, group) };
return { override: this.preferencesService.openFolderSettings(folders[i].uri, true, options, group) };
}
}
}

View file

@ -152,11 +152,17 @@ class KeybindingsEditorInputFactory implements IEditorInputFactory {
class SettingsEditor2InputFactory implements IEditorInputFactory {
public serialize(editorInput: SettingsEditor2Input): string {
return JSON.stringify({});
const input = <DefaultPreferencesEditorInput>editorInput;
const serialized: ISerializedDefaultPreferencesEditorInput = { resource: input.getResource().toString() };
return JSON.stringify(serialized);
}
public deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
return instantiationService.createInstance(SettingsEditor2Input);
public deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): SettingsEditor2Input {
const deserialized: ISerializedDefaultPreferencesEditorInput = JSON.parse(serializedEditorInput);
return instantiationService.createInstance(SettingsEditor2Input, URI.parse(deserialized.resource));
}
}
@ -193,9 +199,10 @@ const category = nls.localize('preferences', "Preferences");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultSettingsAction, OpenRawDefaultSettingsAction.ID, OpenRawDefaultSettingsAction.LABEL), 'Preferences: Open Raw Default Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsAction, OpenSettingsAction.ID, OpenSettingsAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_COMMA }), 'Preferences: Open Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsJsonAction, OpenSettingsJsonAction.ID, OpenSettingsJsonAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_COMMA }), 'Preferences: Open Settings (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_COMMA }), 'Preferences: Open Settings (UI)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsJsonAction, OpenSettingsJsonAction.ID, OpenSettingsJsonAction.LABEL), 'Preferences: Open Settings (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (UI)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDefaultKeybindingsFileAction, OpenDefaultKeybindingsFileAction.ID, OpenDefaultKeybindingsFileAction.LABEL), 'Preferences: Open Default Keyboard Shortcuts File', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: null }), 'Preferences: Open Keyboard Shortcuts File', category);

View file

@ -33,7 +33,7 @@ import { getOutOfWorkspaceEditorResources } from 'vs/workbench/parts/search/comm
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { prepareQuery, IPreparedQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { IFileService } from 'vs/platform/files/common/files';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { untildify } from 'vs/base/common/labels';
export class FileQuickOpenModel extends QuickOpenModel {
@ -127,7 +127,7 @@ export class OpenFileHandler extends QuickOpenHandler {
@ISearchService private searchService: ISearchService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IFileService private fileService: IFileService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super();
@ -173,7 +173,7 @@ export class OpenFileHandler extends QuickOpenHandler {
const fileMatch = complete.results[i];
const label = paths.basename(fileMatch.resource.fsPath);
const description = this.uriDisplayService.getLabel(resources.dirname(fileMatch.resource), true);
const description = this.uriLabelService.getLabel(resources.dirname(fileMatch.resource), true);
results.push(this.instantiationService.createInstance(FileEntry, fileMatch.resource, label, description, iconClass));
}

View file

@ -23,7 +23,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IWorkspaceSymbolProvider, getWorkspaceSymbols, IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import { basename } from 'vs/base/common/paths';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
class SymbolEntry extends EditorQuickOpenEntry {
@ -34,7 +34,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
private _provider: IWorkspaceSymbolProvider,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IEditorService editorService: IEditorService,
@IUriDisplayService private _uriDisplayService: IUriDisplayService
@IUriLabelService private _uriLabelService: IUriLabelService
) {
super(editorService);
}
@ -53,7 +53,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
if (containerName) {
return `${containerName}${basename(this._bearing.location.uri.fsPath)}`;
} else {
return this._uriDisplayService.getLabel(this._bearing.location.uri, true);
return this._uriLabelService.getLabel(this._bearing.location.uri, true);
}
}
return containerName;

View file

@ -27,7 +27,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
import { WorkbenchTreeController, WorkbenchTree } from 'vs/platform/list/browser/listService';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export class SearchDataSource implements IDataSource {
@ -318,7 +318,7 @@ export class SearchRenderer extends Disposable implements IRenderer {
export class SearchAccessibilityProvider implements IAccessibilityProvider {
constructor(
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
}
@ -328,7 +328,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider {
}
if (element instanceof FileMatch) {
const path = this.uriDisplayService.getLabel(element.resource(), true) || element.resource().fsPath;
const path = this.uriLabelService.getLabel(element.resource(), true) || element.resource().fsPath;
return nls.localize('fileMatchAriaLabel', "{0} matches in file {1} of folder {2}, Search result", element.count(), element.name(), paths.dirname(path));
}

View file

@ -76,7 +76,7 @@ namespace schema {
const extensionLocation = extension.description.extensionLocation;
const snippetLocation = resources.joinPath(extensionLocation, snippet.path);
if (!resources.isEqualOrParent(snippetLocation, extensionLocation)) {
if (!resources.isEqualOrParent(snippetLocation, extensionLocation, resources.hasToIgnoreCase(snippetLocation))) {
extension.collector.error(localize(
'invalid.path.1',
"Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.",

View file

@ -40,7 +40,7 @@ import { getIdAndVersionFromLocalExtensionId } from 'vs/platform/extensionManage
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { TimeoutTimer } from 'vs/base/common/async';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
used();
@ -226,7 +226,7 @@ class WelcomePage {
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IConfigurationService private configurationService: IConfigurationService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IUriDisplayService private uriDisplayService: IUriDisplayService,
@IUriLabelService private uriLabelService: IUriLabelService,
@INotificationService private notificationService: INotificationService,
@IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService,
@IExtensionGalleryService private extensionGalleryService: IExtensionGalleryService,
@ -283,9 +283,9 @@ class WelcomePage {
let resource: URI;
if (isSingleFolderWorkspaceIdentifier(workspace)) {
resource = workspace;
label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService);
label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService);
} else if (isWorkspaceIdentifier(workspace)) {
label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService);
label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService);
resource = URI.file(workspace.configPath);
} else {
label = getBaseLabel(workspace);
@ -307,7 +307,7 @@ class WelcomePage {
}
parentFolderPath = tildify(parentFolder, this.environmentService.userHome);
} else {
parentFolderPath = this.uriDisplayService.getLabel(resource);
parentFolderPath = this.uriLabelService.getLabel(resource);
}

View file

@ -24,7 +24,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { emptyProgressRunner, IProgress, IProgressRunner } from 'vs/platform/progress/common/progress';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
abstract class Recording {
@ -233,7 +233,7 @@ export class BulkEdit {
@ITextModelService private readonly _textModelService: ITextModelService,
@IFileService private readonly _fileService: IFileService,
@ITextFileService private readonly _textFileService: ITextFileService,
@IUriDisplayService private readonly _uriDisplayServie: IUriDisplayService
@IUriLabelService private readonly _uriLabelServie: IUriLabelService
) {
this._editor = editor;
this._progress = progress || emptyProgressRunner;
@ -339,7 +339,7 @@ export class BulkEdit {
const conflicts = edits
.filter(edit => recording.hasChanged(edit.resource))
.map(edit => this._uriDisplayServie.getLabel(edit.resource, true));
.map(edit => this._uriLabelServie.getLabel(edit.resource, true));
recording.stop();
@ -369,7 +369,7 @@ export class BulkEditService implements IBulkEditService {
@ITextModelService private readonly _textModelService: ITextModelService,
@IFileService private readonly _fileService: IFileService,
@ITextFileService private readonly _textFileService: ITextFileService,
@IUriDisplayService private readonly _uriDisplayService: IUriDisplayService
@IUriLabelService private readonly _uriLabelService: IUriLabelService
) {
}
@ -400,7 +400,7 @@ export class BulkEditService implements IBulkEditService {
}
}
const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._uriDisplayService);
const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._uriLabelService);
bulkEdit.add(edits);
return TPromise.wrap(bulkEdit.perform().then(() => {

View file

@ -41,7 +41,7 @@ import { UserConfiguration } from 'vs/platform/configuration/node/configuration'
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import { isEqual, hasToIgnoreCase } from 'vs/base/common/resources';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
export class WorkspaceService extends Disposable implements IWorkspaceConfigurationService, IWorkspaceContextService {
@ -69,7 +69,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
public readonly onDidChangeWorkbenchState: Event<WorkbenchState> = this._onDidChangeWorkbenchState.event;
private fileService: IFileService;
private uriDisplayService: IUriDisplayService;
private uriLabelService: IUriLabelService;
private configurationEditingService: ConfigurationEditingService;
private jsonEditingService: JSONEditingService;
@ -319,8 +319,8 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
});
}
acquireUriDisplayService(uriDisplayService: IUriDisplayService): void {
this.uriDisplayService = uriDisplayService;
acquireUriLabelService(uriLabelService: IUriLabelService): void {
this.uriLabelService = uriLabelService;
}
acquireInstantiationService(instantiationService: IInstantiationService): void {
@ -346,7 +346,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
.then(() => {
const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), URI.file(dirname(workspaceConfigPath.fsPath)));
const workspaceId = workspaceIdentifier.id;
const workspaceName = getWorkspaceLabel({ id: workspaceId, configPath: workspaceConfigPath.fsPath }, this.environmentService, this.uriDisplayService);
const workspaceName = getWorkspaceLabel({ id: workspaceId, configPath: workspaceConfigPath.fsPath }, this.environmentService, this.uriLabelService);
return new Workspace(workspaceId, workspaceName, workspaceFolders, workspaceConfigPath);
});
}
@ -369,11 +369,11 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
}
const id = createHash('md5').update(folder.fsPath).update(ctime ? String(ctime) : '').digest('hex');
return new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriDisplayService), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime);
return new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriLabelService), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime);
});
} else {
const id = createHash('md5').update(folder.toString()).digest('hex');
return TPromise.as(new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriDisplayService), toWorkspaceFolders([{ uri: folder.toString() }]), null));
return TPromise.as(new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriLabelService), toWorkspaceFolders([{ uri: folder.toString() }]), null));
}
}

View file

@ -28,7 +28,7 @@ import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/l
import { coalesce } from 'vs/base/common/arrays';
import { isCodeEditor, isDiffEditor, ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorGroupView, IEditorOpeningEvent, EditorGroupsServiceImpl, EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
type ICachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput;
@ -64,7 +64,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
@IEditorGroupsService private editorGroupService: EditorGroupsServiceImpl,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IUriDisplayService private uriDisplayService: IUriDisplayService,
@IUriLabelService private uriLabelService: IUriLabelService,
@IFileService private fileService: IFileService,
@IConfigurationService private configurationService: IConfigurationService
) {
@ -563,7 +563,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
// Otherwise: for diff labels prefer to see the path as part of the label
return this.uriDisplayService.getLabel(res, true);
return this.uriLabelService.getLabel(res, true);
}
//#endregion
@ -584,7 +584,7 @@ export class DelegatingEditorService extends EditorService {
@IEditorGroupsService editorGroupService: EditorGroupsServiceImpl,
@IUntitledEditorService untitledEditorService: IUntitledEditorService,
@IInstantiationService instantiationService: IInstantiationService,
@IUriDisplayService uriDisplayService: IUriDisplayService,
@IUriLabelService uriLabelService: IUriLabelService,
@IFileService fileService: IFileService,
@IConfigurationService configurationService: IConfigurationService
) {
@ -592,7 +592,7 @@ export class DelegatingEditorService extends EditorService {
editorGroupService,
untitledEditorService,
instantiationService,
uriDisplayService,
uriLabelService,
fileService,
configurationService
);

View file

@ -46,7 +46,7 @@ export class OutOfProcessWin32FolderWatcher {
const stdoutLineDecoder = new decoder.LineDecoder();
// Events over stdout
this.handle.stdout.on('data', (data: NodeBuffer) => {
this.handle.stdout.on('data', (data: Buffer) => {
// Collect raw events from output
const rawEvents: IRawFileChange[] = [];
@ -86,13 +86,13 @@ export class OutOfProcessWin32FolderWatcher {
// Errors
this.handle.on('error', (error: Error) => this.onError(error));
this.handle.stderr.on('data', (data: NodeBuffer) => this.onError(data));
this.handle.stderr.on('data', (data: Buffer) => this.onError(data));
// Exit
this.handle.on('exit', (code: number, signal: string) => this.onExit(code, signal));
}
private onError(error: Error | NodeBuffer): void {
private onError(error: Error | Buffer): void {
this.errorCallback('[FileWatcher] process error: ' + error.toString());
}

View file

@ -60,7 +60,7 @@ export class JSONValidationExtensionPoint {
if (strings.startsWith(uri, './')) {
try {
const colorThemeLocation = resources.joinPath(extensionLocation, uri);
if (colorThemeLocation.path.indexOf(extensionLocation.path) !== 0) {
if (!resources.isEqualOrParent(colorThemeLocation, extensionLocation, resources.hasToIgnoreCase(colorThemeLocation))) {
collector.warn(nls.localize('invalid.path.1', "Expected `contributes.{0}.url` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.", configurationExtPoint.name, location, extensionLocation.path));
}
} catch (e) {

View file

@ -36,7 +36,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { assign } from 'vs/base/common/objects';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroup, IEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/editorGroupsService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
const emptyEditableSettingsContent = '{\n}';
@ -45,6 +45,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
_serviceBrand: any;
private lastOpenedSettingsInput: PreferencesEditorInput = null;
private lastOpenedSettings2Input: SettingsEditor2Input = null;
private readonly _onDispose: Emitter<void> = new Emitter<void>();
@ -70,7 +71,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
@IModelService private modelService: IModelService,
@IJSONEditingService private jsonEditingService: IJSONEditingService,
@IModeService private modeService: IModeService,
@IUriDisplayService private uriDisplayService: IUriDisplayService
@IUriLabelService private uriLabelService: IUriLabelService
) {
super();
// The default keybindings.json updates based on keyboard layouts, so here we make sure
@ -176,34 +177,52 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return this.editorService.openEditor({ resource: this.userSettingsResource });
}
openSettings(): TPromise<IEditor> {
openSettings(jsonEditor?: boolean): TPromise<IEditor> {
if (!jsonEditor) {
return this.openSettings2();
}
const editorInput = this.getActiveSettingsEditorInput() || this.lastOpenedSettingsInput;
const resource = editorInput ? editorInput.master.getResource() : this.userSettingsResource;
const target = this.getConfigurationTargetFromSettingsResource(resource);
return this.openOrSwitchSettings(target, resource);
}
openGlobalSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
return this.openOrSwitchSettings(ConfigurationTarget.USER, this.userSettingsResource, options, group);
private openSettings2(): TPromise<IEditor> {
const editorInput = this.getActiveSettingsEditor2Input() || this.lastOpenedSettings2Input;
const resource = editorInput ? editorInput.getResource() : this.userSettingsResource;
const target = this.getConfigurationTargetFromSettingsResource(resource);
return this.openOrSwitchSettings2(target);
}
openSettings2(): TPromise<IEditor> {
return this.editorService.openEditor(this.instantiationService.createInstance(SettingsEditor2Input), { pinned: true }).then(() => null);
openGlobalSettings(jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
return jsonEditor ?
this.openOrSwitchSettings(ConfigurationTarget.USER, this.userSettingsResource, options, group) :
this.openOrSwitchSettings2(ConfigurationTarget.USER, options, group);
}
openWorkspaceSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
openWorkspaceSettings(jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
this.notificationService.info(nls.localize('openFolderFirst', "Open a folder first to create workspace settings"));
return TPromise.as(null);
}
return this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE, this.workspaceSettingsResource, options, group);
return jsonEditor ?
this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE, this.workspaceSettingsResource, options, group) :
this.openOrSwitchSettings2(ConfigurationTarget.WORKSPACE, options, group);
}
openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
return this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE_FOLDER, this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE_FOLDER, folder), options, group);
openFolderSettings(folder: URI, jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
return jsonEditor ?
this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE_FOLDER, this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE_FOLDER, folder), options, group) :
this.openOrSwitchSettings2(ConfigurationTarget.WORKSPACE_FOLDER, options, group);
}
switchSettings(target: ConfigurationTarget, resource: URI): TPromise<void> {
switchSettings(target: ConfigurationTarget, resource: URI, jsonEditor?: boolean): TPromise<void> {
if (!jsonEditor) {
return this.switchSettings2(target);
}
const activeControl = this.editorService.activeControl;
if (activeControl && activeControl.input instanceof PreferencesEditorInput) {
return this.doSwitchSettings(target, resource, activeControl.input, activeControl.group).then(() => null);
@ -212,6 +231,16 @@ export class PreferencesService extends Disposable implements IPreferencesServic
}
}
switchSettings2(target: ConfigurationTarget): TPromise<void> {
const activeControl = this.editorService.activeControl;
const resource = this.getDefaultSettingsResource(target);
if (activeControl && activeControl.input instanceof SettingsEditor2Input) {
return this.doSwitchSettings2(resource, activeControl.input, activeControl.group).then(() => null);
} else {
return this.doOpenSettings2(resource).then(() => null);
}
}
openGlobalKeybindingSettings(textual: boolean): TPromise<void> {
/* __GDPR__
"openKeybindings" : {
@ -271,6 +300,16 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return this.doOpenSettings(configurationTarget, resource, options, group);
}
private openOrSwitchSettings2(configurationTarget: ConfigurationTarget, options?: IEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): TPromise<IEditor> {
const editorInput = this.getActiveSettingsEditor2Input(group);
const resource = this.getDefaultSettingsResource(configurationTarget);
if (editorInput && editorInput.getResource().fsPath !== resource.fsPath) {
return this.doSwitchSettings2(resource, editorInput, group);
}
return this.doOpenSettings2(resource, options, group);
}
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
const openDefaultSettings = !!this.configurationService.getValue(DEFAULT_SETTINGS_EDITOR_SETTING);
return this.getOrCreateEditableSettingsEditorInput(configurationTarget, resource)
@ -291,6 +330,12 @@ export class PreferencesService extends Disposable implements IPreferencesServic
});
}
private doOpenSettings2(resource: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
const settingsEditorInput = this.instantiationService.createInstance(SettingsEditor2Input, resource);
this.lastOpenedSettings2Input = settingsEditorInput;
return this.editorService.openEditor(settingsEditorInput, options, group);
}
private doSwitchSettings(target: ConfigurationTarget, resource: URI, input: PreferencesEditorInput, group: IEditorGroup): TPromise<IEditor> {
return this.getOrCreateEditableSettingsEditorInput(target, this.getEditableSettingsURI(target, resource))
.then(toInput => {
@ -308,10 +353,28 @@ export class PreferencesService extends Disposable implements IPreferencesServic
});
}
private doSwitchSettings2(resource: URI, input: SettingsEditor2Input, group: IEditorGroup): TPromise<IEditor> {
return group.openEditor(input).then(() => {
const replaceWith = this.instantiationService.createInstance(SettingsEditor2Input, resource);
return group.replaceEditors([{
editor: input,
replacement: replaceWith
}]).then(() => {
this.lastOpenedSettings2Input = replaceWith;
return group.activeControl;
});
});
}
private getActiveSettingsEditorInput(group: IEditorGroup = this.editorGroupService.activeGroup): PreferencesEditorInput {
return <PreferencesEditorInput>group.editors.filter(e => e instanceof PreferencesEditorInput)[0];
}
private getActiveSettingsEditor2Input(group: IEditorGroup = this.editorGroupService.activeGroup): SettingsEditor2Input {
return <SettingsEditor2Input>group.editors.filter(e => e instanceof SettingsEditor2Input)[0];
}
private getConfigurationTargetFromSettingsResource(resource: URI): ConfigurationTarget {
if (this.userSettingsResource.toString() === resource.toString()) {
return ConfigurationTarget.USER;
@ -445,7 +508,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => {
if ((<FileOperationError>error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
return this.fileService.updateContent(resource, contents).then(null, error => {
return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriDisplayService.getLabel(resource, true), error)));
return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(resource, true), error)));
});
}

View file

@ -152,12 +152,11 @@ export interface IPreferencesService {
createPreferencesEditorModel<T>(uri: URI): TPromise<IPreferencesEditorModel<T>>;
openRawDefaultSettings(): TPromise<IEditor>;
openSettings(): TPromise<IEditor>;
openSettings2(): TPromise<IEditor>;
openGlobalSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
openWorkspaceSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
switchSettings(target: ConfigurationTarget, resource: URI): TPromise<void>;
openSettings(jsonEditor?: boolean): TPromise<IEditor>;
openGlobalSettings(jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
openWorkspaceSettings(jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
openFolderSettings(folder: URI, jsonEditor?: boolean, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
switchSettings(target: ConfigurationTarget, resource: URI, jsonEditor?: boolean): TPromise<void>;
openGlobalKeybindingSettings(textual: boolean): TPromise<void>;
openDefaultKeybindingsFile(): TPromise<IEditor>;

View file

@ -13,8 +13,6 @@ import { EditorInput, SideBySideEditorInput, Verbosity } from 'vs/workbench/comm
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { KeybindingsEditorModel } from 'vs/workbench/services/preferences/common/keybindingsEditorModel';
import { IPreferencesService } from './preferences';
import { DefaultSettingsEditorModel } from './preferencesModels';
export class PreferencesEditorInput extends SideBySideEditorInput {
public static readonly ID: string = 'workbench.editorinputs.preferencesEditorInput';
@ -79,29 +77,18 @@ export class KeybindingsEditorInput extends EditorInput {
}
}
export class SettingsEditor2Input extends EditorInput {
export class SettingsEditor2Input extends ResourceEditorInput {
public static readonly ID: string = 'workbench.input.settings2';
constructor(
@IPreferencesService private preferencesService: IPreferencesService
constructor(defaultSettingsResource: URI,
@ITextModelService textModelResolverService: ITextModelService,
@IHashService hashService: IHashService
) {
super();
super(nls.localize('settingsEditor2InputName', "Settings (Preview)"), '', defaultSettingsResource, textModelResolverService, hashService);
}
getTypeId(): string {
return SettingsEditor2Input.ID;
}
getName(): string {
return nls.localize('settingsEditor2InputName', "Settings (Preview)");
}
resolve(): TPromise<DefaultSettingsEditorModel> {
return <TPromise<DefaultSettingsEditorModel>>this.preferencesService.createPreferencesEditorModel(URI.parse('vscode://defaultsettings/0/settings.json'));
}
matches(otherInput: any): boolean {
return otherInput instanceof SettingsEditor2Input;
}
}

Some files were not shown because too many files have changed in this diff Show more