diff --git a/extensions/php/src/features/completionItemProvider.ts b/extensions/php/src/features/completionItemProvider.ts index 6eb3b0953db..426649fb314 100644 --- a/extensions/php/src/features/completionItemProvider.ts +++ b/extensions/php/src/features/completionItemProvider.ts @@ -14,6 +14,8 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise { let result: CompletionItem[] = []; + var range = document.getWordRangeAtPosition(position); + var prefix = range ? document.getText(range) : ''; var added : any = {}; var createNewProposal = function(kind: CompletionItemKind, name: string, entry: phpGlobals.IEntry) : CompletionItem { @@ -30,39 +32,45 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider return proposal; }; + var matches = (name:string) => { + return prefix.length === 0 || name.length > prefix.length && name.substr(0, prefix.length) === prefix; + } + for (var name in phpGlobals.globalvariables) { - if (phpGlobals.globalvariables.hasOwnProperty(name)) { + if (phpGlobals.globalvariables.hasOwnProperty(name) && matches(name)) { added[name] = true; result.push(createNewProposal(CompletionItemKind.Variable, name, phpGlobals.globalvariables[name])); } } for (var name in phpGlobals.globalfunctions) { - if (phpGlobals.globalfunctions.hasOwnProperty(name)) { + if (phpGlobals.globalfunctions.hasOwnProperty(name) && matches(name)) { added[name] = true; result.push(createNewProposal(CompletionItemKind.Function, name, phpGlobals.globalfunctions[name])); } } for (var name in phpGlobals.compiletimeconstants) { - if (phpGlobals.compiletimeconstants.hasOwnProperty(name)) { + if (phpGlobals.compiletimeconstants.hasOwnProperty(name) && matches(name)) { added[name] = true; result.push(createNewProposal(CompletionItemKind.Field, name, phpGlobals.compiletimeconstants[name])); } } for (var name in phpGlobals.keywords) { - if (phpGlobals.keywords.hasOwnProperty(name)) { + if (phpGlobals.keywords.hasOwnProperty(name) && matches(name)) { added[name] = true; result.push(createNewProposal(CompletionItemKind.Keyword, name, phpGlobals.keywords[name])); } } var text = document.getText(); - var variableMatch = /\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g; - var match : RegExpExecArray = null; - while (match = variableMatch.exec(text)) { - var word = match[0]; - if (!added[word]) { - added[word] = true; - result.push(createNewProposal(CompletionItemKind.Variable, word, null)); + if (matches('$')) { + var variableMatch = /\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g; + var match : RegExpExecArray = null; + while (match = variableMatch.exec(text)) { + var word = match[0]; + if (!added[word]) { + added[word] = true; + result.push(createNewProposal(CompletionItemKind.Variable, word, null)); + } } } var functionMatch = /function\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/g; diff --git a/extensions/theme-colorful-defaults/package.json b/extensions/theme-colorful-defaults/package.json new file mode 100644 index 00000000000..41318692e88 --- /dev/null +++ b/extensions/theme-colorful-defaults/package.json @@ -0,0 +1,25 @@ +{ + "name": "theme-colorful-defaults", + "displayName": "Colorful Default Themes - Please provide feedback in issue 1849", + "description": "The default VS Code Light and Dark themes with a touch of color. We are considering adding these to the default themes in the January release. Please provide feedback in issue 1849.", + "categories": [ "Themes" ], + "version": "0.1.5", + "publisher": "aeschli", + "engines": { "vscode": "*" }, + "contributes": { + "themes": [ + { + "label": "Dark+", + "description": "Default dark theme with a touch of color", + "uiTheme": "vs-dark", + "path": "./themes/dark_plus.tmTheme" + }, + { + "label": "Light+", + "description": "Default light theme with a touch of color", + "uiTheme": "vs", + "path": "./themes/light_plus.tmTheme" + } + ] + } +} \ No newline at end of file diff --git a/extensions/theme-dark-plus/themes/dark_plus.tmTheme b/extensions/theme-colorful-defaults/themes/dark_plus.tmTheme similarity index 100% rename from extensions/theme-dark-plus/themes/dark_plus.tmTheme rename to extensions/theme-colorful-defaults/themes/dark_plus.tmTheme diff --git a/extensions/theme-dark-plus/themes/light_plus.tmTheme b/extensions/theme-colorful-defaults/themes/light_plus.tmTheme similarity index 100% rename from extensions/theme-dark-plus/themes/light_plus.tmTheme rename to extensions/theme-colorful-defaults/themes/light_plus.tmTheme diff --git a/extensions/theme-dark-plus/package.json b/extensions/theme-dark-plus/package.json deleted file mode 100644 index 83d805bda92..00000000000 --- a/extensions/theme-dark-plus/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "theme-dark-plus", - "version": "0.1.0", - "publisher": "vscode", - "engines": { "vscode": "*" }, - "contributes": { - "themes": [ - { - "label": "Dark+", - "description": "Dark theme with a touch of color", - "uiTheme": "vs-dark", - "path": "./themes/dark_plus.tmTheme" - }, - { - "label": "Light+", - "description": "Light theme with a touch of color", - "uiTheme": "vs", - "path": "./themes/light_plus.tmTheme" - } - ] - } -} \ No newline at end of file diff --git a/src/vs/editor/browser/widget/media/tokens.css b/src/vs/editor/browser/widget/media/tokens.css index aa83928a7f0..6798f1cdcac 100644 --- a/src/vs/editor/browser/widget/media/tokens.css +++ b/src/vs/editor/browser/widget/media/tokens.css @@ -14,8 +14,6 @@ .monaco-editor.vs .token.constant { color: #dd0000; } .monaco-editor.vs .token.string { color: #A31515; } .monaco-editor.vs .token.string.escape { color: #A31515; } -.monaco-editor.vs .token.comment { color: #008000; } -.monaco-editor.vs .token.comment.shebang { color: #929292; } .monaco-editor.vs .token.literal { color: #000000; } .monaco-editor.vs .token.literal.string { color: #A31515; } .monaco-editor.vs .token.literal.hex { color: #e07000; } @@ -83,7 +81,6 @@ /* VSXML */ .monaco-editor.vs .token.vs { color: #006400; } -.monaco-editor.vs .token.comment.vs { color: #aeb9ae; } .monaco-editor.vs .token.tag.vs { color: #aeb9ae; } .monaco-editor.vs .token.attribute.name.vs { color: #aeb9ae; } .monaco-editor.vs .token.attribute.value.vs { color: #2c51cc; } @@ -109,9 +106,6 @@ .monaco-editor.vs-dark .token.constant { color: #dd0000; } .monaco-editor.vs-dark .token.string { color: #CE9178; } .monaco-editor.vs-dark .token.string.escape { color: #CE9178; } -.monaco-editor.vs-dark .token.comment { color: #929292; } -.monaco-editor.vs-dark .token.comment.shebang { color: #929292; } -.monaco-editor.vs-dark .token.comment.doc { color: #608B4E; } .monaco-editor.vs-dark .token.literal { color: #e00000; } .monaco-editor.vs-dark .token.literal.hex { color: #e07000; } .monaco-editor.vs-dark .token.number { color: #B5CEA8; } @@ -204,9 +198,6 @@ .monaco-editor.hc-black .token.constant { color: #dd0000; } .monaco-editor.hc-black .token.string { color: #CE9178; } .monaco-editor.hc-black .token.string.escape { color: #CE9178; } -.monaco-editor.hc-black .token.comment { color: #008000; } -.monaco-editor.hc-black .token.comment.shebang { color: #929292; } -.monaco-editor.hc-black .token.comment.doc { color: #608B4E; } .monaco-editor.hc-black .token.literal { color: #FFFFFF; } .monaco-editor.hc-black .token.literal.hex { color: #FFFFFF; } @@ -301,18 +292,7 @@ .monaco-editor.vs .token.builtin.function { color: #0000FF; } -.monaco-editor.vs .token.comment, -.monaco-editor.vs .token.comment.block, -.monaco-editor.vs .token.comment.block.documentation, -.monaco-editor.vs .token.comment.line { color: #008000; } -/* -.monaco-editor.vs .token.comment.line.documentation -.monaco-editor.vs .token.comment.line.double-slash -.monaco-editor.vs .token.comment.line.double-dash -.monaco-editor.vs .token.comment.line.number-sign -.monaco-editor.vs .token.comment.line.percentage -.monaco-editor.vs .token.comment.line.character -*/ +.monaco-editor.vs .token.comment { color: #008000; } .monaco-editor.vs .token.constant { color: #dd0000; } .monaco-editor.vs .token.constant.language { color: #0000FF; } @@ -441,15 +421,7 @@ .monaco-editor.vs-dark .token.builtin.function { color: #569CD6; } -.monaco-editor.vs-dark .token.comment, -.monaco-editor.vs-dark .token.comment.block, -.monaco-editor.vs-dark .token.comment.block.documentation, -.monaco-editor.vs-dark .token.comment.line { color: #608B4E; } -/*.monaco-editor.vs-dark .token.comment.line.double-slash -.monaco-editor.vs-dark .token.comment.line.double-dash -.monaco-editor.vs-dark .token.comment.line.number-sign -.monaco-editor.vs-dark .token.comment.line.percentage -.monaco-editor.vs-dark .token.comment.line.character*/ +.monaco-editor.vs-dark .token.comment { color: #608B4E; } .monaco-editor.vs-dark .token.constant { color: #569CD6; } .monaco-editor.vs-dark .token.constant.language { color: #569CD6; } @@ -578,15 +550,7 @@ .monaco-editor.hc-black .token.builtin.function { color: #569CD6; } -.monaco-editor.hc-black .token.comment, -.monaco-editor.hc-black .token.comment.block, -.monaco-editor.hc-black .token.comment.block.documentation, -.monaco-editor.hc-black .token.comment.line { color: #608B4E; } -/*.monaco-editor.hc-black .token.comment.line.double-slash -.monaco-editor.hc-black .token.comment.line.double-dash -.monaco-editor.hc-black .token.comment.line.number-sign -.monaco-editor.hc-black .token.comment.line.percentage -.monaco-editor.hc-black .token.comment.line.character*/ +.monaco-editor.hc-black .token.comment { color: #608B4E; } .monaco-editor.hc-black .token.constant { color: #569CD6; } .monaco-editor.hc-black .token.constant.language { color: #569CD6; } diff --git a/src/vs/editor/common/modes/languageFeatureRegistry.ts b/src/vs/editor/common/modes/languageFeatureRegistry.ts index f33ff2648f0..2dccfabe3e4 100644 --- a/src/vs/editor/common/modes/languageFeatureRegistry.ts +++ b/src/vs/editor/common/modes/languageFeatureRegistry.ts @@ -23,6 +23,7 @@ interface Entry { export default class LanguageFeatureRegistry { + private _clock: number = 0; private _entries: Entry[] = []; private _onDidChange = new Emitter(); private _supportName: string; @@ -41,7 +42,7 @@ export default class LanguageFeatureRegistry { selector, provider, _score: -1, - _time: Date.now() + _time: this._clock++ }; this._entries.push(entry); @@ -129,7 +130,7 @@ export default class LanguageFeatureRegistry { selector: undefined, provider: model.getMode()[this._supportName], _score: .5, - _time: 0 + _time: -1 }; supportIndex = ~binarySearch(this._entries, supportEntry, LanguageFeatureRegistry._compareByScoreAndTime); } diff --git a/src/vs/workbench/parts/debug/browser/breakpointWidget.ts b/src/vs/workbench/parts/debug/browser/breakpointWidget.ts index 0d3169785b1..f05ceab53af 100644 --- a/src/vs/workbench/parts/debug/browser/breakpointWidget.ts +++ b/src/vs/workbench/parts/debug/browser/breakpointWidget.ts @@ -6,27 +6,42 @@ import 'vs/css!../browser/media/breakpointWidget'; import async = require('vs/base/common/async'); import errors = require('vs/base/common/errors'); -import { CommonKeybindings } from 'vs/base/common/keyCodes'; +import { CommonKeybindings, KeyCode } from 'vs/base/common/keyCodes'; import platform = require('vs/base/common/platform'); import lifecycle = require('vs/base/common/lifecycle'); import dom = require('vs/base/browser/dom'); import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; +import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import editorbrowser = require('vs/editor/browser/editorBrowser'); import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; +import { IKeybindingService, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybindingService'; import debug = require('vs/workbench/parts/debug/common/debug'); const $ = dom.emmet; +const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = 'breakpointWidgetVisible'; +const CLOSE_BREAKPOINT_WIDGET_COMMAND_ID = 'closeBreakpointWidget'; export class BreakpointWidget extends ZoneWidget { + + public static INSTANCE: BreakpointWidget; + private inputBox: InputBox; + private toDispose: lifecycle.IDisposable[]; + private breakpointWidgetVisible: IKeybindingContextKey; constructor(editor: editorbrowser.ICodeEditor, private lineNumber: number, @IContextViewService private contextViewService: IContextViewService, - @debug.IDebugService private debugService: debug.IDebugService + @debug.IDebugService private debugService: debug.IDebugService, + @IKeybindingService keybindingService: IKeybindingService ) { super(editor, { showFrame: true, showArrow: false }); + + this.toDispose = []; this.create(); + this.breakpointWidgetVisible = keybindingService.createKey(CONTEXT_BREAKPOINT_WIDGET_VISIBLE, false); + this.breakpointWidgetVisible.set(true); + BreakpointWidget.INSTANCE = this; } public fillContainer(container: HTMLElement): void { @@ -36,15 +51,16 @@ export class BreakpointWidget extends ZoneWidget { const inputBoxContainer = dom.append(container, $('.inputBoxContainer')); this.inputBox = new InputBox(inputBoxContainer, this.contextViewService, { - placeholder: `The breakpoint on line ${ this.lineNumber } will only stop if this condition is true` + placeholder: `Breakpoint on line ${ this.lineNumber } will only stop if this condition is true. 'Enter' to accept, 'esc' to cancel.` }); + this.toDispose.push(this.inputBox); + dom.addClass(this.inputBox.inputElement, platform.isWindows ? 'windows' : platform.isMacintosh ? 'mac' : 'linux'); this.inputBox.value = (breakpoint && breakpoint.condition) ? breakpoint.condition : ''; // Due to an electron bug we have to do the timeout, otherwise we do not get focus setTimeout(() => this.inputBox.focus(), 0); let disposed = false; - const toDispose: [lifecycle.IDisposable] = [this.inputBox, this]; const wrapUp = async.once((success: boolean) => { if (!disposed) { disposed = true; @@ -64,20 +80,29 @@ export class BreakpointWidget extends ZoneWidget { this.debugService.toggleBreakpoint(raw).done(null, errors.onUnexpectedError); } - lifecycle.disposeAll(toDispose); + this.dispose(); } }); - toDispose.push(dom.addStandardDisposableListener(this.inputBox.inputElement, 'keydown', (e: dom.IKeyboardEvent) => { + this.toDispose.push(dom.addStandardDisposableListener(this.inputBox.inputElement, 'keydown', (e: dom.IKeyboardEvent) => { const isEscape = e.equals(CommonKeybindings.ESCAPE); const isEnter = e.equals(CommonKeybindings.ENTER); if (isEscape || isEnter) { wrapUp(isEnter); } })); + } - toDispose.push(dom.addDisposableListener(this.inputBox.inputElement, 'blur', () => { - wrapUp(true); - })); + public dispose(): void { + super.dispose(); + this.breakpointWidgetVisible.reset(); + BreakpointWidget.INSTANCE = undefined; + lifecycle.disposeAll(this.toDispose); } } + +CommonEditorRegistry.registerEditorCommand(CLOSE_BREAKPOINT_WIDGET_COMMAND_ID, CommonEditorRegistry.commandWeight(8), { primary: KeyCode.Escape, }, false, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, (ctx, editor, args) => { + if (BreakpointWidget.INSTANCE) { + BreakpointWidget.INSTANCE.dispose(); + } +}); diff --git a/src/vs/workbench/parts/debug/browser/debugViewer.ts b/src/vs/workbench/parts/debug/browser/debugViewer.ts index 7453ab451b5..0d080b51cfe 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewer.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewer.ts @@ -846,6 +846,9 @@ export class BreakpointsRenderer implements tree.IRenderer { data.filePath.textContent = labels.getPathLabel(paths.dirname(breakpoint.source.uri.fsPath), this.contextService); data.checkbox.checked = breakpoint.enabled; data.actionBar.context = breakpoint; + if (breakpoint.condition) { + data.breakpoint.title = breakpoint.condition; + } } public disposeTemplate(tree: tree.ITree, templateId: string, templateData: any): void { diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index cc30aa2921f..a5570c248e0 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -424,8 +424,12 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService } public editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): Promise { - const breakpointWidget = this.instantiationService.createInstance(BreakpointWidget, editor, lineNumber); - breakpointWidget.show({ lineNumber, column: 1 }, 2); + if (BreakpointWidget.INSTANCE) { + BreakpointWidget.INSTANCE.dispose(); + } + + this.instantiationService.createInstance(BreakpointWidget, editor, lineNumber); + BreakpointWidget.INSTANCE.show({ lineNumber, column: 1 }, 2); return Promise.as(true); }