提交 0b5c09c1 编写于 作者: J João Moreno

Merge branch 'master' of github.com:Microsoft/vscode

......@@ -12,5 +12,6 @@
".build/**": true,
"out*/**": true,
"extensions/**/out/**": true
}
},
"filePicker.alternateFileNameMatching": true
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
......@@ -462,7 +462,11 @@
</dict>
<dict>
<key>include</key>
<string>#mixins</string>
<string>#mixin_definition</string>
</dict>
<dict>
<key>include</key>
<string>#mixin_call</string>
</dict>
<dict>
<key>include</key>
......@@ -592,26 +596,6 @@
<key>name</key>
<string>meta.first-class.jade</string>
</dict>
<key>brackets_js</key>
<dict>
<key>begin</key>
<string>\[</string>
<key>end</key>
<string>\]</string>
<key>name</key>
<string>js.value.attribute.tag.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#brackets_js</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>case_conds</key>
<dict>
<key>begin</key>
......@@ -712,7 +696,7 @@
</dict>
<dict>
<key>include</key>
<string>#mixins</string>
<string>#mixin_call</string>
</dict>
<dict>
<key>include</key>
......@@ -946,7 +930,7 @@
</dict>
<dict>
<key>include</key>
<string>#mixins</string>
<string>#mixin_call</string>
</dict>
<dict>
<key>begin</key>
......@@ -1081,60 +1065,155 @@
</dict>
</array>
</dict>
<key>mixins</key>
<key>js_braces</key>
<dict>
<key>begin</key>
<string>\{</string>
<key>end</key>
<string>\}</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#js_braces</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>js_brackets</key>
<dict>
<key>begin</key>
<string>\[</string>
<key>end</key>
<string>\]</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#js_brackets</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>js_parens</key>
<dict>
<key>begin</key>
<string>\(</string>
<key>end</key>
<string>\)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#js_parens</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>mixin_call</key>
<dict>
<key>begin</key>
<string>(((mixin\s+)|\+)([\w-]+))\s*</string>
<string>((?:mixin\s+)|\+)([\w-]+)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function.jade</string>
</dict>
<key>4</key>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
<string>meta.tag.other entity.name.function.jade</string>
</dict>
</dict>
<key>comment</key>
<string>Mixin declaration and use, including the new '+' syntax.</string>
<key>end</key>
<string>(?=\])|$</string>
<key>name</key>
<string>source.meta.function</string>
<string>(?!\()|$</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string></string>
<string>(?&lt;!\))\(</string>
<key>end</key>
<string>(?=\])|$</string>
<string>\)</string>
<key>name</key>
<string>args.mixin.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag_attribute_value_paren</string>
<string>#js_parens</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_brackets</string>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_braces</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.tag.other entity.other.attribute-name.tag.jade</string>
</dict>
</dict>
<key>match</key>
<string>([^\s(),=/]+)\s*=\s*</string>
</dict>
<dict>
<key>include</key>
<string>#complete_tag</string>
<string>source.js</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#tag_attributes</string>
</dict>
</array>
</dict>
<key>mixin_definition</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function.jade</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>meta.tag.other entity.name.function.jade</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.begin.js</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>variable.parameter.function.js</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.begin.js</string>
</dict>
</dict>
<key>match</key>
<string>(mixin\s+)([\w-]+)(?:(\()((?:[a-zA-Z_]\w*(?:,\s*)?)*)(\)))?$</string>
</dict>
<key>printed_expression</key>
<dict>
<key>begin</key>
......@@ -1155,7 +1234,7 @@
<array>
<dict>
<key>include</key>
<string>#brackets_js</string>
<string>#js_brackets</string>
</dict>
<dict>
<key>include</key>
......@@ -1189,106 +1268,43 @@
</dict>
</array>
</dict>
<key>tag_attribute_value_braces</key>
<key>tag_attribute_name</key>
<dict>
<key>begin</key>
<string>\{</string>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>js.value.attribute.tag.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag_attribute_value_paren</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_brackets</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_braces</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>tag_attribute_value_brackets</key>
<dict>
<key>begin</key>
<string>\[</string>
<key>end</key>
<string>\]</string>
<key>name</key>
<string>js.value.attribute.tag.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag_attribute_value_paren</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_brackets</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_braces</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>include</key>
<string>source.js</string>
<key>name</key>
<string>entity.other.attribute-name.tag.jade</string>
</dict>
</array>
</dict>
<key>match</key>
<string>([^\s(),=/!]+)\s*</string>
</dict>
<key>tag_attribute_value_paren</key>
<key>tag_attribute_name_paren</key>
<dict>
<key>begin</key>
<string>\(</string>
<string>\(\s*</string>
<key>end</key>
<string>\)</string>
<key>name</key>
<string>js.value.attribute.tag.jade</string>
<string>entity.other.attribute-name.tag.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag_attribute_value_paren</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_brackets</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_braces</string>
<string>#tag_attribute_name_paren</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
<string>#tag_attribute_name</string>
</dict>
</array>
</dict>
<key>tag_attributes</key>
<dict>
<key>begin</key>
<string>(\()</string>
<string>(\(\s*)</string>
<key>captures</key>
<dict>
<key>1</key>
......@@ -1304,52 +1320,74 @@
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.other.attribute-name.tag.jade</string>
</dict>
</dict>
<key>include</key>
<string>#tag_attribute_name_paren</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_name</string>
</dict>
<dict>
<key>match</key>
<string>([^\s(),=/]+)\s*((?=\))|,|\s+|$)(?!\!?\=)</string>
<string>!</string>
<key>name</key>
<string>invalid.illegal.tag.jade</string>
</dict>
<dict>
<key>begin</key>
<string>([^\s(),=/]*[^\s(),=!/])\s*(!?\=)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<string>=\s*</string>
<key>end</key>
<string>$|(?=,|(?:\s+[^!%&amp;*-+~|&lt;&gt;:?/])|\))</string>
<key>name</key>
<string>attribute_value</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>entity.other.attribute-name.tag.jade</string>
<key>include</key>
<string>#string</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.separator.key-value.jade</string>
<key>include</key>
<string>#js_parens</string>
</dict>
</dict>
<dict>
<key>include</key>
<string>#js_brackets</string>
</dict>
<dict>
<key>include</key>
<string>#js_braces</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=[%&amp;*-+~|&lt;&gt;:?/])\s+</string>
<key>end</key>
<string>(,|$|(?=\)|((?&lt;![+/*|&amp;=:^~!?&lt;&gt;%-])\s+[^+/*|&amp;=:^~!?&lt;&gt;%-])))</string>
<string>$|(?=,|(?:\s+[^!%&amp;*-+~|&lt;&gt;:?/])|\))</string>
<key>name</key>
<string>attribute_value2</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag_attribute_value_paren</string>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_brackets</string>
<string>#js_parens</string>
</dict>
<dict>
<key>include</key>
<string>#tag_attribute_value_braces</string>
<string>#js_brackets</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
<string>#js_braces</string>
</dict>
<dict>
<key>include</key>
......@@ -1496,7 +1534,7 @@
<array>
<dict>
<key>include</key>
<string>#brackets_js</string>
<string>#js_brackets</string>
</dict>
<dict>
<key>include</key>
......
......@@ -64,7 +64,7 @@
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "http://json.schemastore.org/project"
"url": "http://json.schemastore.org/package"
},
{
"fileMatch": "bower.json",
......
......@@ -416,9 +416,9 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz"
},
"vscode-debugprotocol": {
"version": "1.0.1",
"from": "vscode-debugprotocol@>=1.0.1",
"resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.0.1.tgz"
"version": "1.1.1",
"from": "vscode-debugprotocol@>=1.1.1",
"resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.1.1.tgz"
},
"vscode-textmate": {
"version": "1.0.9",
......
......@@ -277,7 +277,7 @@ export function isEqualOrParent(path: string, candidate: string): boolean {
// Reference: https://en.wikipedia.org/wiki/Filename
const INVALID_FILE_CHARS = isWindows ? /[\\/:\*\?"<>\|]/g : /[\\/]/g;
const WINDOWS_FORBIDDEN_NAMES = /con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9]/i;
const WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])$/i;
export function isValidBasename(name: string): boolean {
if (!name || name.length === 0 || /^\s+$/.test(name)) {
return false; // require a name that is not just whitespace
......
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
* Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This document includes material copied
* Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This software or document includes includes material copied
* from or derived from HTML 5.1 W3C Working Draft (http://www.w3.org/TR/2015/WD-html51-20151008/.)"
*--------------------------------------------------------------------------------------------*/
......
......@@ -280,7 +280,10 @@ export class JSONSchemaService implements IJSONSchemaService {
this.contributionAssociations[pattern] = associations;
var fpa = this.getOrAddFilePatternAssociation(pattern);
associations.forEach(schemaId => fpa.addSchema(schemaId));
associations.forEach(schemaId => {
var id = this.normalizeId(schemaId);
fpa.addSchema(id)
});
}
}
}
......@@ -327,7 +330,10 @@ export class JSONSchemaService implements IJSONSchemaService {
for (var pattern in this.contributionAssociations) {
var fpa = this.getOrAddFilePatternAssociation(pattern);
this.contributionAssociations[pattern].forEach(schemaId => fpa.addSchema(schemaId));
this.contributionAssociations[pattern].forEach(schemaId => {
var id = this.normalizeId(schemaId);
fpa.addSchema(id);
});
}
}
......
......@@ -172,7 +172,7 @@
// Return true if the given text is composed entirely of whitespace.
this.is_whitespace = function(text) {
for (var n = 0; n < text.length; text++) {
for (var n = 0; n < text.length; n++) {
if (!this.Utils.in_array(text.charAt(n), this.Utils.whitespace)) {
return false;
}
......@@ -467,7 +467,7 @@
} else if (tag_check === 'script' &&
(tag_complete.search('type') === -1 ||
(tag_complete.search('type') > -1 &&
tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/) > -1))) {
tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json)/) > -1))) {
if (!peek) {
this.record_tag(tag_check);
this.tag_type = 'SCRIPT';
......@@ -525,7 +525,7 @@
matched = false;
this.pos = start_pos;
input_char = this.input.charAt(this.pos);
var input_char = this.input.charAt(this.pos);
this.pos++;
while (this.pos <= this.input.length) {
......@@ -570,15 +570,34 @@
return comment;
};
this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
function tokenMatcher(delimiter) {
var token = '';
var add = function (str) {
var newToken = token + str.toLowerCase();
token = newToken.length <= delimiter.length ? newToken : newToken.substr(newToken.length - delimiter.length, delimiter.length);
};
var doesNotMatch = function () {
return token.indexOf(delimiter) === -1;
};
return {
add: add,
doesNotMatch: doesNotMatch
};
}
this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
return '';
}
var input_char = '';
var content = '';
var min_index = 0;
var space = true;
var delimiterMatcher = tokenMatcher(delimiter);
do {
if (this.pos >= this.input.length) {
......@@ -606,16 +625,17 @@
}
}
content += input_char;
delimiterMatcher.add(input_char);
this.line_char_count++;
space = true;
if (indent_handlebars && input_char === '{' && content.length && content.charAt(content.length - 2) === '{') {
// Handlebars expressions in strings should also be unformatted.
content += this.get_unformatted('}}');
// These expressions are opaque. Ignore delimiters found in them.
min_index = content.length;
// Don't consider when stopping for delimiters.
}
} while (content.toLowerCase().indexOf(delimiter, min_index) === -1);
} while (delimiterMatcher.doesNotMatch());
return content;
};
......@@ -832,6 +852,21 @@
multi_parser.current_mode = 'CONTENT';
break;
case 'TK_TAG_HANDLEBARS_ELSE':
// Don't add a newline if opening {{#if}} tag is on the current line
var foundIfOnCurrentLine = false;
for (var lastCheckedOutput=multi_parser.output.length-1; lastCheckedOutput>=0; lastCheckedOutput--) {
if (multi_parser.output[lastCheckedOutput] === '\n') {
break;
} else {
if (multi_parser.output[lastCheckedOutput].match(/{{#if/)) {
foundIfOnCurrentLine = true;
break;
}
}
}
if (!foundIfOnCurrentLine) {
multi_parser.print_newline(false, multi_parser.output);
}
multi_parser.print_token(multi_parser.token_text);
if (multi_parser.indent_content) {
multi_parser.indent();
......
......@@ -298,6 +298,17 @@ jsonContributionRegistry.registerSchema('http://json-schema.org/draft-04/schema#
],
'description': nls.localize('schema.json.type', 'Either a string of one of the basic schema types (number, integer, null, array, object, boolean, string) or an array of strings specifying a subset of those types.')
},
'format': {
'anyOf': [
{
'type': 'string',
'description': nls.localize('schema.json.format', 'Describes the format expected for the value.'),
'enum': [ 'date-time', 'uri', 'email', 'hostname', 'ipv4', 'ipv6', 'regex']
},{
'type': 'string'
}
]
},
'allOf': {
'allOf': [
{ '$ref': '#/definitions/schemaArray' }
......
......@@ -3319,7 +3319,6 @@ declare namespace vscode {
*
* ```javascript
* export function activate(context: vscode.ExtensionContext) {
*
* let api = {
* sum(a, b) {
* return a + b;
......@@ -3328,7 +3327,6 @@ declare namespace vscode {
* return a * b;
* }
* };
*
* // 'export' public api-surface
* return api;
* }
......
......@@ -13,7 +13,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import keyboard = require('vs/base/browser/keyboardEvent');
import editorbrowser = require('vs/editor/browser/editorBrowser');
import editorcommon = require('vs/editor/common/editorCommon');
import { DebugHoverWidget } from 'vs/workbench/parts/debug/browser/debugHoverWidget';
import { DebugHoverWidget } from 'vs/workbench/parts/debug/browser/debugHover';
import debugactions = require('vs/workbench/parts/debug/electron-browser/debugActions');
import debug = require('vs/workbench/parts/debug/common/debug');
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
......@@ -37,7 +37,7 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
) {
this.breakpointHintDecoration = [];
this.toDispose = [];
this.hoverWidget = new DebugHoverWidget(this.editor, this.debugService);
this.hoverWidget = new DebugHoverWidget(this.editor, this.debugService, this.instantiationService);
this.registerListeners();
}
......@@ -148,7 +148,7 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
// hover business
private onEditorMouseDown(mouseEvent: editorbrowser.IMouseEvent): void {
if (mouseEvent.target.type === editorcommon.MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) {
if (mouseEvent.target.type === editorcommon.MouseTargetType.OVERLAY_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) {
return;
}
......@@ -163,8 +163,8 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
const targetType = mouseEvent.target.type;
const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey';
if (targetType === editorcommon.MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID && !(<any>mouseEvent.event)[stopKey]) {
// mouse moved on top of content hover widget
if (targetType === editorcommon.MouseTargetType.OVERLAY_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID && !(<any>mouseEvent.event)[stopKey]) {
// mouse moved on top of debug hover widget
return;
}
......
......@@ -3,16 +3,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import htmlcontentrenderer = require('vs/base/browser/htmlContentRenderer');
import errors = require('vs/base/common/errors');
import dom = require('vs/base/browser/dom');
import { ITree } from 'vs/base/parts/tree/common/tree';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { DefaultController, ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
import editorbrowser = require('vs/editor/browser/editorBrowser');
import editorcommon = require('vs/editor/common/editorCommon');
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import debug = require('vs/workbench/parts/debug/common/debug');
import { tokenizeToHtmlContent } from 'vs/editor/common/modes/textToHtmlTokenizer';
import viewer = require('vs/workbench/parts/debug/browser/debugViewer');
const $ = dom.emmet;
const stringRegex = /^(['"]).*\1$/;
const debugTreeOptions = {
indentPixels: 8,
twistiePixels: 20
};
export class DebugHoverWidget implements editorbrowser.IContentWidget {
......@@ -22,12 +28,23 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
private domNode: HTMLElement;
private isVisible: boolean;
private tree: ITree;
private showAtPosition: editorcommon.IPosition;
private lastHoveringOver: string;
private highlightDecorations: string[];
private treeContainer: HTMLElement;
private valueContainer: HTMLElement;
constructor(private editor: editorbrowser.ICodeEditor, private debugService: debug.IDebugService) {
constructor(private editor: editorbrowser.ICodeEditor, private debugService: debug.IDebugService, private instantiationService: IInstantiationService) {
this.domNode = $('.debug-hover-widget monaco-editor-background');
this.treeContainer = dom.append(this.domNode, $('.debug-hover-tree'));
this.tree = new Tree(this.treeContainer, {
dataSource: new viewer.VariablesDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.VariablesRenderer),
controller: new DebugHoverController()
}, debugTreeOptions);
this.valueContainer = dom.append(this.domNode, $('.debug-hover-value'));
this.isVisible = false;
this.showAtPosition = null;
this.lastHoveringOver = null;
......@@ -95,8 +112,6 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
return;
}
const variable = variables[0];
// show it
this.highlightDecorations = this.editor.deltaDecorations(this.highlightDecorations, [{
range: {
......@@ -110,54 +125,21 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
}
}]);
this.lastHoveringOver = hoveringOver;
if (variable.reference > 0 && variable.value.indexOf('function') === -1) {
let objectToString = '{\n';
variable.getChildren(this.debugService).then(children => {
if (!children) {
this.hide();
return;
}
for (let i = 0; i < children.length; i++) {
const nameAndValue = ` ${ children[i].name }: ${ children[i].value }`;
objectToString += nameAndValue.substr(0, 80);
// add a quote to the end of the string if cropped
if (nameAndValue.length > 80 && stringRegex.test(children[i].value)) {
objectToString += children[i].value[0];
}
if (i < children.length - 1) {
objectToString += ',\n';
}
}
objectToString += '\n}';
return objectToString;
}).done(value => this.doShow(pos, value), () => this.hide());
} else {
this.doShow(pos, variable.value);
}
this.doShow(pos, variables[0]);
}
private doShow(position: editorcommon.IEditorPosition, value: string): void {
const model = this.editor.getModel();
if (!value || !model) {
return;
}
let crlfCount = 0;
for (let i = 0; i < value.length; i++) {
if (value[i] === '\n') {
crlfCount++;
}
if (crlfCount > 12) {
value = value.substr(0, i + 1) + ' ...\n}';
break;
}
private doShow(position: editorcommon.IEditorPosition, expression: debug.IExpression): void {
if (expression.reference > 0) {
this.valueContainer.hidden = true;
this.treeContainer.hidden = false;
this.tree.setInput(expression).done(null, errors.onUnexpectedError);
this.tree.layout(this.treeContainer.clientHeight);
} else {
this.treeContainer.hidden = true;
this.valueContainer.hidden = false;
viewer.renderExpressionValue(expression, false, this.valueContainer);
}
this.domNode.innerHTML = '';
this.domNode.appendChild(htmlcontentrenderer.renderHtml(tokenizeToHtmlContent(value, model.getMode())));
this.showAtPosition = position;
this.isVisible = true;
this.editor.layoutContentWidget(this);
......@@ -184,3 +166,16 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
} : null;
}
}
class DebugHoverController extends DefaultController {
/* protected */ public onLeftClick(tree: ITree, element: any, eventish: ICancelableEvent, origin: string = 'mouse'): boolean {
if (element.reference > 0) {
super.onLeftClick(tree, element, eventish, origin);
tree.clearFocus();
tree.deselect(element);
}
return true;
}
}
......@@ -35,7 +35,7 @@ const $ = dom.emmet;
const booleanRegex = /^true|false$/i;
const stringRegex = /^(['"]).*\1$/;
export function renderExpressionValue(tree: tree.ITree, arg2: debug.IExpression|string, debugInactive: boolean, container: HTMLElement): void {
export function renderExpressionValue(arg2: debug.IExpression|string, debugInactive: boolean, container: HTMLElement): void {
let value = typeof arg2 === 'string' ? arg2 : arg2.value;
// remove stale classes
......@@ -62,7 +62,7 @@ export function renderVariable(tree: tree.ITree, variable: model.Variable, data:
}
if (variable.value) {
renderExpressionValue(tree, variable, debugInactive, data.value);
renderExpressionValue(variable, debugInactive, data.value);
if (variable.valueChanged && showChanged) {
// value changed color has priority over other colors.
data.value.className = 'value changed';
......@@ -587,7 +587,7 @@ export class WatchExpressionsRenderer implements tree.IRenderer {
private renderExpression(tree: tree.ITree, expression: debug.IExpression, data: IVariableTemplateData): void {
data.name.textContent = `${expression.name}:`;
if (expression.value) {
renderExpressionValue(tree, expression, this.debugService.getState() === debug.State.Inactive, data.value);
renderExpressionValue(expression, this.debugService.getState() === debug.State.Inactive, data.value);
}
}
......
......@@ -138,44 +138,6 @@
background-repeat: no-repeat;
}
/* Hover */
.monaco-editor .debug-hover-widget {
padding: 0 3px 0 3px;
border: 1px solid #CCC;
position: absolute;
margin-top: -1px;
cursor: default;
z-index: 50;
-webkit-animation-duration: 0.15s;
-webkit-animation-name: fadeIn;
-moz-animation-duration: 0.15s;
-moz-animation-name: fadeIn;
-ms-animation-duration: 0.15s;
-ms-animation-name: fadeIn;
animation-duration: 0.15s;
animation-name: fadeIn;
white-space: pre;
min-width: 50px;
-webkit-user-select: text;
-ms-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-o-user-select: text;
overflow: hidden;
}
.monaco-editor .debug-hover-widget pre {
margin-top: 0;
margin-bottom: 0;
}
.monaco-editor .debugHoverHighlight {
background-color: rgba(173, 214, 255, 0.15);
}
/* Expressions */
.monaco-workbench .monaco-tree-row .expression {
......@@ -352,14 +314,6 @@
box-shadow: 0 2px 8px #000;
}
.monaco-editor.vs-dark .debug-hover-widget {
border-color: #555;
}
.monaco-editor.vs-dark .debugHoverHighlight {
background-color: rgba(38, 79, 120, 0.25);
}
/* High Contrast Theming */
.monaco-workbench.hc-black .monaco-tree-row:not(.selected) .expression .name {
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .debug-hover-widget {
padding: 0 3px 0 3px;
border: 1px solid #CCC;
position: absolute;
margin-top: -1px;
cursor: default;
z-index: 50;
-webkit-animation-duration: 0.15s;
-webkit-animation-name: fadeIn;
-moz-animation-duration: 0.15s;
-moz-animation-name: fadeIn;
-ms-animation-duration: 0.15s;
-ms-animation-name: fadeIn;
animation-duration: 0.15s;
animation-name: fadeIn;
white-space: pre;
-webkit-user-select: text;
-ms-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-o-user-select: text;
overflow: hidden;
}
.monaco-editor .debug-hover-widget .debug-hover-tree {
line-height: 24px;
width: 350px;
height: 300px;
}
/* Disable tree hover highlight in debug hover tree. */
.monaco-editor .debug-hover-widget .debug-hover-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row:hover:not(.highlighted):not(.selected):not(.focused) {
background-color: inherit;
}
.monaco-editor .debug-hover-widget .debug-hover-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row {
cursor: default;
}
.monaco-editor .debug-hover-widget .debug-hover-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row.has-children {
cursor: pointer;
}
.monaco-editor .debug-hover-widget pre {
margin-top: 0;
margin-bottom: 0;
}
.monaco-editor .debugHoverHighlight {
background-color: rgba(173, 214, 255, 0.15);
}
.monaco-editor .debug-hover-widget .value {
color: rgba(108, 108, 108, 0.8);
}
.monaco-editor .debug-hover-widget .error {
color: #E51400;
}
.monaco-editor .debug-hover-widget .value.number {
color: #09885A;
}
.monaco-editor .debug-hover-widget .value.boolean {
color: #0000FF;
}
.monaco-editor .debug-hover-widget .value.string {
color: #A31515;
}
/* Dark theme */
.monaco-editor.vs-dark .debug-hover-widget .value {
color: rgba(204, 204, 204, 0.6);
}
.monaco-editor.vs-dark .debug-hover-widget .error {
color: #F48771;
}
.monaco-editor.vs-dark .debug-hover-widget .value.number {
color: #B5CEA8;
}
.monaco-editor.vs-dark .debug-hover-widget .value.boolean {
color: #4E94CE;
}
.monaco-editor.vs-dark .debug-hover-widget .value.string {
color: #CE9178;
}
.monaco-editor.vs-dark .debug-hover-widget {
border-color: #555;
}
.monaco-editor.vs-dark .debugHoverHighlight {
background-color: rgba(38, 79, 120, 0.25);
}
\ No newline at end of file
......@@ -208,7 +208,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
private renderInputOutputPair(tree: tree.ITree, expression: debug.IExpression, templateData: IInputOutputPairTemplateData): void {
templateData.input.textContent = expression.name;
debugviewer.renderExpressionValue(tree, expression, this.debugService.getState() === debug.State.Inactive, templateData.value);
debugviewer.renderExpressionValue(expression, this.debugService.getState() === debug.State.Inactive, templateData.value);
if (expression.reference > 0) {
templateData.annotation.className = 'annotation octicon octicon-info';
templateData.annotation.title = nls.localize('stateCapture', "Object state is captured from first evaluation");
......@@ -401,7 +401,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
}
// value
debugviewer.renderExpressionValue(tree, output.value, false, templateData.value);
debugviewer.renderExpressionValue(output.value, false, templateData.value);
// annotation if any
if (output.annotation) {
......
......@@ -613,7 +613,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return new StackFrame(data.threadId, 0, Source.fromUri(uri.parse('unknown')), nls.localize('unknownStack', "Unknown stack location"), undefined, undefined);
}
return new StackFrame(data.threadId, rsf.id, rsf.source ? Source.fromRawSource(rsf.source) : Source.fromUri(uri.parse('unknown')), rsf.name, rsf.line, rsf.column);
return new StackFrame(data.threadId, rsf.id, rsf.source ? new Source(rsf.source) : Source.fromUri(uri.parse('unknown')), rsf.name, rsf.line, rsf.column);
});
this.threads[data.threadId].stoppedReason = data.stoppedReason;
......
......@@ -444,7 +444,7 @@ declare module DebugProtocol {
name: string;
}
/** A Source .*/
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
......
......@@ -14,11 +14,23 @@ export class Source {
private static INTERNAL_URI_PREFIX = 'debug://internal/';
constructor(public name: string, uriStr: string, public origin: string, public reference = 0) {
this.uri = uri.parse(uriStr);
constructor(private raw: DebugProtocol.Source) {
this.uri = raw.path ? uri.file(raw.path) : uri.parse(Source.INTERNAL_URI_PREFIX + raw.name);
this.available = true;
}
public get name() {
return this.raw.name;
}
public get origin() {
return this.raw.origin;
}
public get reference() {
return this.raw.sourceReference;
}
public get inMemory() {
return Source.isInMemory(this.uri);
}
......@@ -29,13 +41,8 @@ export class Source {
for (let threadId in threads) {
if (threads.hasOwnProperty(threadId) && threads[threadId].callStack) {
const found = threads[threadId].callStack.filter(sf => sf.source.uri.toString() === uri.toString()).pop();
if (found) {
return {
name: found.source.name,
path: found.source.inMemory ? null : found.source.uri.fsPath,
sourceReference: found.source.reference
}
return found.source.raw;
}
}
}
......@@ -45,13 +52,11 @@ export class Source {
{ path: paths.normalize(uri.fsPath, true) };
}
public static fromRawSource(rawSource: DebugProtocol.Source): Source {
const uriStr = rawSource.path ? uri.file(rawSource.path).toString() : Source.INTERNAL_URI_PREFIX + rawSource.name;
return new Source(rawSource.name, uriStr, rawSource.origin, rawSource.sourceReference);
}
public static fromUri(uri: uri): Source {
return new Source(Source.getName(uri), uri.toString(), '');
return new Source({
name: Source.getName(uri),
path: uri.fsPath,
});
}
private static getName(uri: uri): string {
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!../browser/media/debug.contribution';
import 'vs/css!../browser/media/debugHover';
import nls = require('vs/nls');
import { CommonEditorRegistry, ContextKey, EditorActionDescriptor } from 'vs/editor/common/editorCommonExtensions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
......
......@@ -312,7 +312,8 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
private loadBreakpoints(): debug.IBreakpoint[] {
try {
return JSON.parse(this.storageService.get(DEBUG_BREAKPOINTS_KEY, StorageScope.WORKSPACE, '[]')).map((breakpoint: any) => {
return new model.Breakpoint(new Source(breakpoint.source.name, breakpoint.source.uri, breakpoint.source.reference), breakpoint.desiredLineNumber || breakpoint.lineNumber, breakpoint.enabled, breakpoint.condition);
return new model.Breakpoint(breakpoint.source.raw ? new Source(breakpoint.source.raw) : Source.fromUri(uri.parse(breakpoint.source.uri)),
breakpoint.desiredLineNumber || breakpoint.lineNumber, breakpoint.enabled, breakpoint.condition);
});
} catch (e) {
return [];
......
......@@ -15,7 +15,6 @@ suite('Debug - Source', () => {
assert.equal(source.available, true);
assert.equal(source.inMemory, false);
assert.equal(source.reference, 0);
assert.equal(source.uri.toString(), u.toString());
assert.equal(source.name, 'd');
});
......@@ -26,7 +25,7 @@ suite('Debug - Source', () => {
path: '/xx/yy/zz',
sourceReference: 0
};
const source = Source.fromRawSource(rawSource);
const source = new Source(rawSource);
assert.equal(source.available, true);
assert.equal(source.name, rawSource.name);
......@@ -40,7 +39,7 @@ suite('Debug - Source', () => {
name: 'internalModule.js',
sourceReference: 11
};
const source = Source.fromRawSource(rawSource);
const source = new Source(rawSource);
assert.equal(source.available, true);
assert.equal(source.name, rawSource.name);
......
......@@ -167,12 +167,12 @@ export class Engine implements ISearchEngine {
function readFile(isFirstRead: boolean, clb: (error: Error) => void): void {
if (outer.limitReached || outer.isCanceled) {
return callback(null); // return early if canceled or limit reached
return clb(null); // return early if canceled or limit reached
}
fs.read(fd, buffer, 0, buffer.length, null, (error: Error, bytesRead: number, buffer: NodeBuffer) => {
if (error || bytesRead === 0 || outer.limitReached || outer.isCanceled) {
return callback(error); // return early if canceled or limit reached or no more bytes to read
return clb(error); // return early if canceled or limit reached or no more bytes to read
}
pos = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册