@@ -8,8 +8,8 @@ import * as types from './extHostTypes';
88import * as search from 'vs/workbench/parts/search/common/search' ;
99import { ITextEditorOptions } from 'vs/platform/editor/common/editor' ;
1010import { EditorViewColumn } from 'vs/workbench/api/shared/editor' ;
11- import { IDecorationOptions } from 'vs/editor/common/editorCommon' ;
12- import { EndOfLineSequence } from 'vs/editor/common/model' ;
11+ import { IDecorationOptions , IThemeDecorationRenderOptions , IDecorationRenderOptions , IContentDecorationRenderOptions } from 'vs/editor/common/editorCommon' ;
12+ import { EndOfLineSequence , TrackedRangeStickiness } from 'vs/editor/common/model' ;
1313import * as vscode from 'vscode' ;
1414import { URI } from 'vs/base/common/uri' ;
1515import { ProgressLocation as MainProgressLocation } from 'vs/platform/progress/common/progress' ;
@@ -252,6 +252,126 @@ export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.Deco
252252 }
253253}
254254
255+ function pathOrURIToURI ( value : string | URI ) : URI {
256+ if ( typeof value === 'undefined' ) {
257+ return value ;
258+ }
259+ if ( typeof value === 'string' ) {
260+ return URI . file ( value ) ;
261+ } else {
262+ return value ;
263+ }
264+ }
265+
266+ export namespace ThemableDecorationAttachmentRenderOptions {
267+ export function from ( options : vscode . ThemableDecorationAttachmentRenderOptions ) : IContentDecorationRenderOptions {
268+ if ( typeof options === 'undefined' ) {
269+ return options ;
270+ }
271+ return {
272+ contentText : options . contentText ,
273+ contentIconPath : pathOrURIToURI ( options . contentIconPath ) ,
274+ border : options . border ,
275+ borderColor : < string | types . ThemeColor > options . borderColor ,
276+ fontStyle : options . fontStyle ,
277+ fontWeight : options . fontWeight ,
278+ textDecoration : options . textDecoration ,
279+ color : < string | types . ThemeColor > options . color ,
280+ backgroundColor : < string | types . ThemeColor > options . backgroundColor ,
281+ margin : options . margin ,
282+ width : options . width ,
283+ height : options . height ,
284+ } ;
285+ }
286+ }
287+
288+ export namespace ThemableDecorationRenderOptions {
289+ export function from ( options : vscode . ThemableDecorationRenderOptions ) : IThemeDecorationRenderOptions {
290+ if ( typeof options === 'undefined' ) {
291+ return options ;
292+ }
293+ return {
294+ backgroundColor : < string | types . ThemeColor > options . backgroundColor ,
295+ outline : options . outline ,
296+ outlineColor : < string | types . ThemeColor > options . outlineColor ,
297+ outlineStyle : options . outlineStyle ,
298+ outlineWidth : options . outlineWidth ,
299+ border : options . border ,
300+ borderColor : < string | types . ThemeColor > options . borderColor ,
301+ borderRadius : options . borderRadius ,
302+ borderSpacing : options . borderSpacing ,
303+ borderStyle : options . borderStyle ,
304+ borderWidth : options . borderWidth ,
305+ fontStyle : options . fontStyle ,
306+ fontWeight : options . fontWeight ,
307+ textDecoration : options . textDecoration ,
308+ cursor : options . cursor ,
309+ color : < string | types . ThemeColor > options . color ,
310+ opacity : options . opacity ,
311+ letterSpacing : options . letterSpacing ,
312+ gutterIconPath : pathOrURIToURI ( options . gutterIconPath ) ,
313+ gutterIconSize : options . gutterIconSize ,
314+ overviewRulerColor : < string | types . ThemeColor > options . overviewRulerColor ,
315+ before : ThemableDecorationAttachmentRenderOptions . from ( options . before ) ,
316+ after : ThemableDecorationAttachmentRenderOptions . from ( options . after ) ,
317+ } ;
318+ }
319+ }
320+
321+ export namespace DecorationRangeBehavior {
322+ export function from ( value : types . DecorationRangeBehavior ) : TrackedRangeStickiness {
323+ if ( typeof value === 'undefined' ) {
324+ return value ;
325+ }
326+ switch ( value ) {
327+ case types . DecorationRangeBehavior . OpenOpen :
328+ return TrackedRangeStickiness . AlwaysGrowsWhenTypingAtEdges ;
329+ case types . DecorationRangeBehavior . ClosedClosed :
330+ return TrackedRangeStickiness . NeverGrowsWhenTypingAtEdges ;
331+ case types . DecorationRangeBehavior . OpenClosed :
332+ return TrackedRangeStickiness . GrowsOnlyWhenTypingBefore ;
333+ case types . DecorationRangeBehavior . ClosedOpen :
334+ return TrackedRangeStickiness . GrowsOnlyWhenTypingAfter ;
335+ }
336+ }
337+ }
338+
339+ export namespace DecorationRenderOptions {
340+ export function from ( options : vscode . DecorationRenderOptions ) : IDecorationRenderOptions {
341+ return {
342+ isWholeLine : options . isWholeLine ,
343+ rangeBehavior : DecorationRangeBehavior . from ( options . rangeBehavior ) ,
344+ overviewRulerLane : options . overviewRulerLane ,
345+ light : ThemableDecorationRenderOptions . from ( options . light ) ,
346+ dark : ThemableDecorationRenderOptions . from ( options . dark ) ,
347+
348+ backgroundColor : < string | types . ThemeColor > options . backgroundColor ,
349+ outline : options . outline ,
350+ outlineColor : < string | types . ThemeColor > options . outlineColor ,
351+ outlineStyle : options . outlineStyle ,
352+ outlineWidth : options . outlineWidth ,
353+ border : options . border ,
354+ borderColor : < string | types . ThemeColor > options . borderColor ,
355+ borderRadius : options . borderRadius ,
356+ borderSpacing : options . borderSpacing ,
357+ borderStyle : options . borderStyle ,
358+ borderWidth : options . borderWidth ,
359+ fontStyle : options . fontStyle ,
360+ fontWeight : options . fontWeight ,
361+ textDecoration : options . textDecoration ,
362+ cursor : options . cursor ,
363+ color : < string | types . ThemeColor > options . color ,
364+ opacity : options . opacity ,
365+ letterSpacing : options . letterSpacing ,
366+ gutterIconPath : pathOrURIToURI ( options . gutterIconPath ) ,
367+ gutterIconSize : options . gutterIconSize ,
368+ overviewRulerColor : < string | types . ThemeColor > options . overviewRulerColor ,
369+ before : ThemableDecorationAttachmentRenderOptions . from ( options . before ) ,
370+ after : ThemableDecorationAttachmentRenderOptions . from ( options . after ) ,
371+ } ;
372+ }
373+ }
374+
255375export namespace TextEdit {
256376
257377 export function from ( edit : vscode . TextEdit ) : modes . TextEdit {
0 commit comments