提交 60211895 编写于 作者: J Joao Moreno

fixes #2465

上级 6c0b455f
...@@ -312,6 +312,8 @@ class InternalEditorOptionsHelper { ...@@ -312,6 +312,8 @@ class InternalEditorOptionsHelper {
snippetSuggestions: opts.snippetSuggestions, snippetSuggestions: opts.snippetSuggestions,
tabCompletion: opts.tabCompletion, tabCompletion: opts.tabCompletion,
wordBasedSuggestions: opts.wordBasedSuggestions, wordBasedSuggestions: opts.wordBasedSuggestions,
suggestFontSize: opts.suggestFontSize,
suggestLineHeight: opts.suggestLineHeight,
selectionHighlight: toBoolean(opts.selectionHighlight), selectionHighlight: toBoolean(opts.selectionHighlight),
codeLens: opts.referenceInfos && opts.codeLens, codeLens: opts.referenceInfos && opts.codeLens,
folding: toBoolean(opts.folding), folding: toBoolean(opts.folding),
...@@ -765,6 +767,18 @@ let editorConfiguration:IConfigurationNode = { ...@@ -765,6 +767,18 @@ let editorConfiguration:IConfigurationNode = {
'default': DefaultConfig.editor.wordBasedSuggestions, 'default': DefaultConfig.editor.wordBasedSuggestions,
'description': nls.localize('wordBasedSuggestions', "Enable word based suggestions.") 'description': nls.localize('wordBasedSuggestions', "Enable word based suggestions.")
}, },
'editor.suggestFontSize' : {
'type': 'integer',
'default': 0,
'minimum': 0,
'description': nls.localize('suggestFontSize', "Font size for the suggest widget")
},
'editor.suggestLineHeight' : {
'type': 'integer',
'default': 0,
'minimum': 0,
'description': nls.localize('suggestLineHeight', "Line height for the suggest widget")
},
'editor.tabCompletion': { 'editor.tabCompletion': {
'type': 'boolean', 'type': 'boolean',
'default': DefaultConfig.editor.tabCompletion, 'default': DefaultConfig.editor.tabCompletion,
......
...@@ -87,6 +87,8 @@ class ConfigClass implements IConfiguration { ...@@ -87,6 +87,8 @@ class ConfigClass implements IConfiguration {
snippetSuggestions: 'bottom', snippetSuggestions: 'bottom',
tabCompletion: false, tabCompletion: false,
wordBasedSuggestions: true, wordBasedSuggestions: true,
suggestFontSize: 0,
suggestLineHeight: 0,
selectionHighlight: true, selectionHighlight: true,
codeLens: true, codeLens: true,
referenceInfos: true, referenceInfos: true,
......
...@@ -410,6 +410,16 @@ export interface IEditorOptions { ...@@ -410,6 +410,16 @@ export interface IEditorOptions {
* Enable word based suggestions. Defaults to 'true' * Enable word based suggestions. Defaults to 'true'
*/ */
wordBasedSuggestions?: boolean; wordBasedSuggestions?: boolean;
/**
* The font size for the suggest widget.
* Defaults to the editor font size.
*/
suggestFontSize?: number;
/**
* The line height for the suggest widget.
* Defaults to the editor line height.
*/
suggestLineHeight?: number;
/** /**
* Enable selection highlight. * Enable selection highlight.
* Defaults to true. * Defaults to true.
...@@ -854,6 +864,8 @@ export class EditorContribOptions { ...@@ -854,6 +864,8 @@ export class EditorContribOptions {
snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
tabCompletion: boolean; tabCompletion: boolean;
wordBasedSuggestions: boolean; wordBasedSuggestions: boolean;
suggestFontSize: number;
suggestLineHeight: number;
selectionHighlight:boolean; selectionHighlight:boolean;
codeLens: boolean; codeLens: boolean;
folding: boolean; folding: boolean;
...@@ -875,6 +887,8 @@ export class EditorContribOptions { ...@@ -875,6 +887,8 @@ export class EditorContribOptions {
snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
tabCompletion: boolean; tabCompletion: boolean;
wordBasedSuggestions: boolean; wordBasedSuggestions: boolean;
suggestFontSize: number;
suggestLineHeight: number;
selectionHighlight:boolean; selectionHighlight:boolean;
codeLens: boolean; codeLens: boolean;
folding: boolean; folding: boolean;
...@@ -892,6 +906,8 @@ export class EditorContribOptions { ...@@ -892,6 +906,8 @@ export class EditorContribOptions {
this.snippetSuggestions = source.snippetSuggestions; this.snippetSuggestions = source.snippetSuggestions;
this.tabCompletion = source.tabCompletion; this.tabCompletion = source.tabCompletion;
this.wordBasedSuggestions = source.wordBasedSuggestions; this.wordBasedSuggestions = source.wordBasedSuggestions;
this.suggestFontSize = source.suggestFontSize;
this.suggestLineHeight = source.suggestLineHeight;
this.selectionHighlight = Boolean(source.selectionHighlight); this.selectionHighlight = Boolean(source.selectionHighlight);
this.codeLens = Boolean(source.codeLens); this.codeLens = Boolean(source.codeLens);
this.folding = Boolean(source.folding); this.folding = Boolean(source.folding);
...@@ -915,6 +931,8 @@ export class EditorContribOptions { ...@@ -915,6 +931,8 @@ export class EditorContribOptions {
&& this.snippetSuggestions === other.snippetSuggestions && this.snippetSuggestions === other.snippetSuggestions
&& this.tabCompletion === other.tabCompletion && this.tabCompletion === other.tabCompletion
&& this.wordBasedSuggestions === other.wordBasedSuggestions && this.wordBasedSuggestions === other.wordBasedSuggestions
&& this.suggestFontSize === other.suggestFontSize
&& this.suggestLineHeight === other.suggestLineHeight
&& this.selectionHighlight === other.selectionHighlight && this.selectionHighlight === other.selectionHighlight
&& this.codeLens === other.codeLens && this.codeLens === other.codeLens
&& this.folding === other.folding && this.folding === other.folding
......
...@@ -82,22 +82,26 @@ class Renderer implements IRenderer<ICompletionItem, ISuggestionTemplateData> { ...@@ -82,22 +82,26 @@ class Renderer implements IRenderer<ICompletionItem, ISuggestionTemplateData> {
data.documentationDetails.title = nls.localize('readMore', "Read More...{0}", this.triggerKeybindingLabel); data.documentationDetails.title = nls.localize('readMore', "Read More...{0}", this.triggerKeybindingLabel);
const configureFont = () => { const configureFont = () => {
const fontInfo = this.editor.getConfiguration().fontInfo; const configuration = this.editor.getConfiguration();
const lineHeight = `${ fontInfo.lineHeight }px`; const fontFamily = configuration.fontInfo.fontFamily;
const fontSize = configuration.contribInfo.suggestFontSize || configuration.fontInfo.fontSize;
data.root.style.fontSize = `${ fontInfo.fontSize }px`; const lineHeight = configuration.contribInfo.suggestLineHeight || configuration.fontInfo.lineHeight;
main.style.fontFamily = fontInfo.fontFamily; const fontSizePx = `${ fontSize }px`;
main.style.lineHeight = lineHeight; const lineHeightPx = `${ lineHeight }px`;
data.icon.style.height = lineHeight;
data.icon.style.width = lineHeight; data.root.style.fontSize = fontSizePx;
data.documentationDetails.style.height = lineHeight; main.style.fontFamily = fontFamily;
data.documentationDetails.style.width = lineHeight; main.style.lineHeight = lineHeightPx;
data.icon.style.height = lineHeightPx;
data.icon.style.width = lineHeightPx;
data.documentationDetails.style.height = lineHeightPx;
data.documentationDetails.style.width = lineHeightPx;
}; };
configureFont(); configureFont();
chain<IConfigurationChangedEvent>(this.editor.onDidChangeConfiguration.bind(this.editor)) chain<IConfigurationChangedEvent>(this.editor.onDidChangeConfiguration.bind(this.editor))
.filter(e => e.fontInfo) .filter(e => e.fontInfo || e.contribInfo)
.on(configureFont, null, data.disposables); .on(configureFont, null, data.disposables);
return data; return data;
...@@ -262,15 +266,18 @@ class SuggestionDetails { ...@@ -262,15 +266,18 @@ class SuggestionDetails {
} }
private configureFont() { private configureFont() {
const fontInfo = this.editor.getConfiguration().fontInfo; const configuration = this.editor.getConfiguration();
const fontSize = `${ fontInfo.fontSize }px`; const fontFamily = configuration.fontInfo.fontFamily;
const lineHeight = `${ fontInfo.lineHeight }px`; const fontSize = configuration.contribInfo.suggestFontSize || configuration.fontInfo.fontSize;
const lineHeight = configuration.contribInfo.suggestLineHeight || configuration.fontInfo.lineHeight;
const fontSizePx = `${ fontSize }px`;
const lineHeightPx = `${ lineHeight }px`;
this.el.style.fontSize = fontSize; this.el.style.fontSize = fontSizePx;
this.title.style.fontFamily = fontInfo.fontFamily; this.title.style.fontFamily = fontFamily;
this.type.style.fontFamily = fontInfo.fontFamily; this.type.style.fontFamily = fontFamily;
this.back.style.height = lineHeight; this.back.style.height = lineHeightPx;
this.back.style.width = lineHeight; this.back.style.width = lineHeightPx;
} }
dispose(): void { dispose(): void {
...@@ -754,8 +761,8 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem> ...@@ -754,8 +761,8 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
} }
private get unfocusedHeight(): number { private get unfocusedHeight(): number {
const fontInfo = this.editor.getConfiguration().fontInfo; const configuration = this.editor.getConfiguration();
return fontInfo.lineHeight; return configuration.contribInfo.suggestLineHeight || configuration.fontInfo.lineHeight;
} }
// IDelegate // IDelegate
......
...@@ -1273,6 +1273,16 @@ declare module monaco.editor { ...@@ -1273,6 +1273,16 @@ declare module monaco.editor {
* Enable word based suggestions. Defaults to 'true' * Enable word based suggestions. Defaults to 'true'
*/ */
wordBasedSuggestions?: boolean; wordBasedSuggestions?: boolean;
/**
* The font size for the suggest widget.
* Defaults to the editor font size.
*/
suggestFontSize?: number;
/**
* The line height for the suggest widget.
* Defaults to the editor line height.
*/
suggestLineHeight?: number;
/** /**
* Enable selection highlight. * Enable selection highlight.
* Defaults to true. * Defaults to true.
...@@ -1453,6 +1463,8 @@ declare module monaco.editor { ...@@ -1453,6 +1463,8 @@ declare module monaco.editor {
snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
tabCompletion: boolean; tabCompletion: boolean;
wordBasedSuggestions: boolean; wordBasedSuggestions: boolean;
suggestFontSize: number;
suggestLineHeight: number;
selectionHighlight: boolean; selectionHighlight: boolean;
codeLens: boolean; codeLens: boolean;
folding: boolean; folding: boolean;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册