提交 f79cba94 编写于 作者: B Benjamin Pasero

fix #23472

上级 5e234bf1
......@@ -23,6 +23,7 @@ import { rename } from '../common/rename';
import RenameInputField from './renameInputField';
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
import { optional } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from "vs/platform/theme/common/themeService";
// --- register actions and commands
......@@ -46,9 +47,10 @@ class RenameController implements IEditorContribution {
@ITextModelResolverService private _textModelResolverService: ITextModelResolverService,
@IProgressService private _progressService: IProgressService,
@IContextKeyService contextKeyService: IContextKeyService,
@IThemeService themeService: IThemeService,
@optional(IFileService) private _fileService: IFileService
) {
this._renameInputField = new RenameInputField(editor);
this._renameInputField = new RenameInputField(editor, themeService);
this._renameInputVisible = CONTEXT_RENAME_INPUT_VISIBLE.bindTo(contextKeyService);
}
......
......@@ -13,6 +13,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { Range } from 'vs/editor/common/core/range';
import { IPosition, IRange } from 'vs/editor/common/editorCommon';
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { IThemeService, ITheme } from "vs/platform/theme/common/themeService";
import { inputBackground, inputBorder, inputForeground } from "vs/platform/theme/common/colorRegistry";
export default class RenameInputField implements IContentWidget, IDisposable {
......@@ -26,7 +28,7 @@ export default class RenameInputField implements IContentWidget, IDisposable {
// Editor.IContentWidget.allowEditorOverflow
public allowEditorOverflow: boolean = true;
constructor(editor: ICodeEditor) {
constructor(editor: ICodeEditor, @IThemeService private themeService: IThemeService) {
this._editor = editor;
this._editor.addContentWidget(this);
......@@ -35,6 +37,12 @@ export default class RenameInputField implements IContentWidget, IDisposable {
this.updateFont();
}
}));
this._disposables.push(themeService.onThemeChange(theme => this.onThemeChange(theme)));
}
private onThemeChange(theme: ITheme): void {
this.updateStyles(theme);
}
public dispose(): void {
......@@ -58,10 +66,28 @@ export default class RenameInputField implements IContentWidget, IDisposable {
this._domNode.appendChild(this._inputField);
this.updateFont();
this.updateStyles(this.themeService.getTheme());
}
return this._domNode;
}
private updateStyles(theme: ITheme): void {
if (!this._inputField) {
return;
}
const background = theme.getColor(inputBackground);
const foreground = theme.getColor(inputForeground);
const border = theme.getColor(inputBorder);
this._inputField.style.backgroundColor = background ? background.toString() : null;
this._inputField.style.color = foreground ? foreground.toString() : null;
this._inputField.style.borderWidth = border ? '1px' : null;
this._inputField.style.borderStyle = border ? 'solid' : null;
this._inputField.style.borderColor = border ? border.toString() : null;
}
private updateFont(): void {
if (!this._inputField) {
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册