Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b9189cad
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b9189cad
编写于
3月 21, 2017
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[theme] introduce IStandaloneThemeService
上级
99dafc38
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
61 addition
and
51 deletion
+61
-51
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+1
-1
src/vs/editor/browser/services/standaloneThemeServiceImpl.ts
src/vs/editor/browser/services/standaloneThemeServiceImpl.ts
+12
-2
src/vs/editor/browser/standalone/colorizer.ts
src/vs/editor/browser/standalone/colorizer.ts
+3
-3
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
+10
-10
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+5
-5
src/vs/editor/browser/standalone/standaloneLanguages.ts
src/vs/editor/browser/standalone/standaloneLanguages.ts
+7
-7
src/vs/editor/browser/standalone/standaloneServices.ts
src/vs/editor/browser/standalone/standaloneServices.ts
+3
-3
src/vs/editor/common/modes/monarch/monarchLexer.ts
src/vs/editor/common/modes/monarch/monarchLexer.ts
+7
-7
src/vs/editor/common/services/standaloneThemeService.ts
src/vs/editor/common/services/standaloneThemeService.ts
+3
-3
src/vs/editor/common/standalone/themes.ts
src/vs/editor/common/standalone/themes.ts
+2
-2
src/vs/editor/contrib/inspectTokens/browser/inspectTokens.ts
src/vs/editor/contrib/inspectTokens/browser/inspectTokens.ts
+8
-8
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
b9189cad
...
...
@@ -53,7 +53,7 @@ declare module monaco {
declare module monaco.editor {
#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.;editorCommon.=>):
#include(vs/editor/common/services/standalone
Color
Service): BuiltinTheme, IStandaloneThemeData, IColors
#include(vs/editor/common/services/standalone
Theme
Service): BuiltinTheme, IStandaloneThemeData, IColors
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
...
...
src/vs/editor/browser/services/standalone
Color
ServiceImpl.ts
→
src/vs/editor/browser/services/standalone
Theme
ServiceImpl.ts
浏览文件 @
b9189cad
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
TokenTheme
,
ITokenThemeRule
,
generateTokensCSSForColorMap
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
IStandalone
ColorService
,
BuiltinTheme
,
IStandaloneThemeData
,
IStandaloneTheme
,
IColors
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
,
BuiltinTheme
,
IStandaloneThemeData
,
IStandaloneTheme
,
IColors
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
vs
,
vs_dark
,
hc_black
}
from
'
vs/editor/common/standalone/themes
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
TokenizationRegistry
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -13,6 +13,7 @@ import { Color } from "vs/base/common/color";
import
{
Extensions
,
IColorRegistry
,
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Extensions
as
ThemingExtensions
,
IThemingRegistry
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
const
VS_THEME_NAME
=
'
vs
'
;
const
VS_DARK_THEME_NAME
=
'
vs-dark
'
;
...
...
@@ -114,15 +115,19 @@ function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme {
return
new
StandaloneTheme
(
builtinTheme
,
''
,
themeData
.
colors
,
themeData
.
rules
);
}
export
class
Standalone
ColorServiceImpl
implements
IStandaloneColor
Service
{
export
class
Standalone
ThemeServiceImpl
implements
IStandaloneTheme
Service
{
_serviceBrand
:
any
;
private
_knownThemes
:
Map
<
string
,
StandaloneTheme
>
;
private
_styleElement
:
HTMLStyleElement
;
private
_theme
:
IStandaloneTheme
;
private
_onThemeChange
:
Emitter
<
IStandaloneTheme
>
;
constructor
()
{
this
.
_onThemeChange
=
new
Emitter
<
IStandaloneTheme
>
();
this
.
_knownThemes
=
new
Map
<
string
,
StandaloneTheme
>
();
this
.
_knownThemes
.
set
(
VS_THEME_NAME
,
newBuiltInTheme
(
VS_THEME_NAME
));
this
.
_knownThemes
.
set
(
VS_DARK_THEME_NAME
,
newBuiltInTheme
(
VS_DARK_THEME_NAME
));
...
...
@@ -132,6 +137,10 @@ export class StandaloneColorServiceImpl implements IStandaloneColorService {
this
.
setTheme
(
VS_THEME_NAME
);
}
public
get
onThemeChange
():
Event
<
IStandaloneTheme
>
{
return
this
.
_onThemeChange
.
event
;
}
public
defineTheme
(
themeName
:
string
,
themeData
:
IStandaloneThemeData
):
void
{
if
(
!
/^
[
a-z0-9
\-]
+$/i
.
test
(
themeName
)
||
isBuiltinTheme
(
themeName
))
{
throw
new
Error
(
'
Illegal theme name!
'
);
...
...
@@ -189,6 +198,7 @@ export class StandaloneColorServiceImpl implements IStandaloneColorService {
this
.
_styleElement
.
innerHTML
=
cssRules
.
join
(
'
\n
'
);
TokenizationRegistry
.
setColorMap
(
colorMap
);
this
.
_onThemeChange
.
fire
(
theme
);
return
theme
.
id
;
}
...
...
src/vs/editor/browser/standalone/colorizer.ts
浏览文件 @
b9189cad
...
...
@@ -13,7 +13,7 @@ import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/vie
import
{
ViewLineToken
}
from
'
vs/editor/common/core/viewLineToken
'
;
import
{
LineTokens
}
from
'
vs/editor/common/core/lineTokens
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
export
interface
IColorizerOptions
{
tabSize
?:
number
;
...
...
@@ -26,7 +26,7 @@ export interface IColorizerElementOptions extends IColorizerOptions {
export
class
Colorizer
{
public
static
colorizeElement
(
standaloneColorService
:
IStandaloneColor
Service
,
modeService
:
IModeService
,
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
TPromise
<
void
>
{
public
static
colorizeElement
(
themeService
:
IStandaloneTheme
Service
,
modeService
:
IModeService
,
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
TPromise
<
void
>
{
options
=
options
||
{};
let
theme
=
options
.
theme
||
'
vs
'
;
let
mimeType
=
options
.
mimeType
||
domNode
.
getAttribute
(
'
lang
'
)
||
domNode
.
getAttribute
(
'
data-lang
'
);
...
...
@@ -35,7 +35,7 @@ export class Colorizer {
return
undefined
;
}
standaloneColor
Service
.
setTheme
(
theme
);
theme
Service
.
setTheme
(
theme
);
let
text
=
domNode
.
firstChild
.
nodeValue
;
domNode
.
className
+=
'
monaco-editor
'
+
theme
;
...
...
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
浏览文件 @
b9189cad
...
...
@@ -20,7 +20,7 @@ import { IEditorContextViewService } from 'vs/editor/browser/standalone/standalo
import
{
CodeEditor
}
from
'
vs/editor/browser/codeEditor
'
;
import
{
DiffEditorWidget
}
from
'
vs/editor/browser/widget/diffEditorWidget
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
InternalEditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
MenuId
,
MenuRegistry
,
IMenuItem
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -185,7 +185,7 @@ export class StandaloneCodeEditor extends CodeEditor implements IStandaloneCodeE
export
class
StandaloneEditor
extends
StandaloneCodeEditor
implements
IStandaloneCodeEditor
{
private
_contextViewService
:
IEditorContextViewService
;
private
_standalone
ColorService
:
IStandaloneColor
Service
;
private
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
_ownsModel
:
boolean
;
private
_toDispose2
:
IDisposable
[];
...
...
@@ -199,17 +199,17 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IStandalone
ColorService
standaloneColorService
:
IStandaloneColor
Service
@
IStandalone
ThemeService
standaloneThemeService
:
IStandaloneTheme
Service
)
{
options
=
options
||
{};
if
(
typeof
options
.
theme
===
'
string
'
)
{
options
.
theme
=
standalone
Color
Service
.
setTheme
(
options
.
theme
);
options
.
theme
=
standalone
Theme
Service
.
setTheme
(
options
.
theme
);
}
super
(
domElement
,
options
,
instantiationService
,
codeEditorService
,
commandService
,
contextKeyService
,
keybindingService
);
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_standalone
ColorService
=
standaloneColor
Service
;
this
.
_standalone
ThemeService
=
standaloneTheme
Service
;
this
.
_toDispose2
=
[
toDispose
];
let
model
:
IModel
=
null
;
...
...
@@ -243,7 +243,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
public
updateOptions
(
newOptions
:
IEditorOptions
):
void
{
if
(
typeof
newOptions
.
theme
===
'
string
'
)
{
newOptions
.
theme
=
this
.
_standalone
Color
Service
.
setTheme
(
newOptions
.
theme
);
newOptions
.
theme
=
this
.
_standalone
Theme
Service
.
setTheme
(
newOptions
.
theme
);
}
super
.
updateOptions
(
newOptions
);
}
...
...
@@ -267,7 +267,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
export
class
StandaloneDiffEditor
extends
DiffEditorWidget
implements
IStandaloneDiffEditor
{
private
_contextViewService
:
IEditorContextViewService
;
private
_standalone
ColorService
:
IStandaloneColor
Service
;
private
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
_standaloneKeybindingService
:
StandaloneKeybindingService
;
private
_toDispose2
:
IDisposable
[];
...
...
@@ -279,7 +279,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IStandalone
ColorService
standaloneColorService
:
IStandaloneColor
Service
,
@
IStandalone
ThemeService
standaloneColorService
:
IStandaloneTheme
Service
,
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
)
{
options
=
options
||
{};
...
...
@@ -294,7 +294,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
}
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_standalone
Color
Service
=
standaloneColorService
;
this
.
_standalone
Theme
Service
=
standaloneColorService
;
this
.
_toDispose2
=
[
toDispose
];
...
...
@@ -312,7 +312,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
public
updateOptions
(
newOptions
:
IEditorOptions
):
void
{
if
(
typeof
newOptions
.
theme
===
'
string
'
)
{
newOptions
.
theme
=
this
.
_standalone
Color
Service
.
setTheme
(
newOptions
.
theme
);
newOptions
.
theme
=
this
.
_standalone
Theme
Service
.
setTheme
(
newOptions
.
theme
);
}
super
.
updateOptions
(
newOptions
);
}
...
...
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
b9189cad
...
...
@@ -31,7 +31,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
ITextModelResolverService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
NULL_STATE
,
nullTokenize
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
IStandaloneThemeData
,
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandaloneThemeData
,
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
Token
}
from
'
vs/editor/common/core/token
'
;
import
{
FontInfo
,
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
...
...
@@ -92,7 +92,7 @@ export function create(domElement: HTMLElement, options?: IEditorConstructionOpt
services
.
get
(
IContextKeyService
),
services
.
get
(
IKeybindingService
),
services
.
get
(
IContextViewService
),
services
.
get
(
IStandalone
Color
Service
)
services
.
get
(
IStandalone
Theme
Service
)
);
});
}
...
...
@@ -123,7 +123,7 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
services
.
get
(
IContextKeyService
),
services
.
get
(
IKeybindingService
),
services
.
get
(
IContextViewService
),
services
.
get
(
IStandalone
Color
Service
),
services
.
get
(
IStandalone
Theme
Service
),
services
.
get
(
IEditorWorkerService
)
);
});
...
...
@@ -244,7 +244,7 @@ export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>
* Colorize the contents of `domNode` using attribute `data-lang`.
*/
export
function
colorizeElement
(
domNode
:
HTMLElement
,
options
:
IColorizerElementOptions
):
TPromise
<
void
>
{
return
Colorizer
.
colorizeElement
(
StaticServices
.
standalone
Color
Service
.
get
(),
StaticServices
.
modeService
.
get
(),
domNode
,
options
);
return
Colorizer
.
colorizeElement
(
StaticServices
.
standalone
Theme
Service
.
get
(),
StaticServices
.
modeService
.
get
(),
domNode
,
options
);
}
/**
...
...
@@ -302,7 +302,7 @@ export function tokenize(text: string, languageId: string): Token[][] {
* Define a new theme.
*/
export
function
defineTheme
(
themeName
:
string
,
themeData
:
IStandaloneThemeData
):
void
{
StaticServices
.
standalone
Color
Service
.
get
().
defineTheme
(
themeName
,
themeData
);
StaticServices
.
standalone
Theme
Service
.
get
().
defineTheme
(
themeName
,
themeData
);
}
/**
...
...
src/vs/editor/browser/standalone/standaloneLanguages.ts
浏览文件 @
b9189cad
...
...
@@ -23,7 +23,7 @@ import { createTokenizationSupport } from 'vs/editor/common/modes/monarch/monarc
import
{
LanguageConfigurationRegistry
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
import
{
Token
,
TokenizationResult
,
TokenizationResult2
}
from
'
vs/editor/common/core/token
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
/**
* Register information about a new language.
...
...
@@ -73,12 +73,12 @@ export function setLanguageConfiguration(languageId: string, configuration: Lang
*/
export
class
TokenizationSupport2Adapter
implements
modes
.
ITokenizationSupport
{
private
readonly
_standalone
ColorService
:
IStandaloneColor
Service
;
private
readonly
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
readonly
_languageIdentifier
:
modes
.
LanguageIdentifier
;
private
readonly
_actual
:
TokensProvider
;
constructor
(
standalone
ColorService
:
IStandaloneColor
Service
,
languageIdentifier
:
modes
.
LanguageIdentifier
,
actual
:
TokensProvider
)
{
this
.
_standalone
ColorService
=
standaloneColor
Service
;
constructor
(
standalone
ThemeService
:
IStandaloneTheme
Service
,
languageIdentifier
:
modes
.
LanguageIdentifier
,
actual
:
TokensProvider
)
{
this
.
_standalone
ThemeService
=
standaloneTheme
Service
;
this
.
_languageIdentifier
=
languageIdentifier
;
this
.
_actual
=
actual
;
}
...
...
@@ -113,7 +113,7 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
private
_toBinaryTokens
(
tokens
:
IToken
[],
offsetDelta
:
number
):
Uint32Array
{
let
languageId
=
this
.
_languageIdentifier
.
id
;
let
tokenTheme
=
this
.
_standalone
Color
Service
.
getTheme
().
tokenTheme
;
let
tokenTheme
=
this
.
_standalone
Theme
Service
.
getTheme
().
tokenTheme
;
let
result
:
number
[]
=
[],
resultLen
=
0
;
for
(
let
i
=
0
,
len
=
tokens
.
length
;
i
<
len
;
i
++
)
{
...
...
@@ -195,7 +195,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider):
if
(
!
languageIdentifier
)
{
throw
new
Error
(
`Cannot set tokens provider for unknown language
${
languageId
}
`
);
}
let
adapter
=
new
TokenizationSupport2Adapter
(
StaticServices
.
standalone
Color
Service
.
get
(),
languageIdentifier
,
provider
);
let
adapter
=
new
TokenizationSupport2Adapter
(
StaticServices
.
standalone
Theme
Service
.
get
(),
languageIdentifier
,
provider
);
return
modes
.
TokenizationRegistry
.
register
(
languageId
,
adapter
);
}
...
...
@@ -204,7 +204,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider):
*/
export
function
setMonarchTokensProvider
(
languageId
:
string
,
languageDef
:
IMonarchLanguage
):
IDisposable
{
let
lexer
=
compile
(
languageId
,
languageDef
);
let
adapter
=
createTokenizationSupport
(
StaticServices
.
modeService
.
get
(),
StaticServices
.
standalone
Color
Service
.
get
(),
languageId
,
lexer
);
let
adapter
=
createTokenizationSupport
(
StaticServices
.
modeService
.
get
(),
StaticServices
.
standalone
Theme
Service
.
get
(),
languageId
,
lexer
);
return
modes
.
TokenizationRegistry
.
register
(
languageId
,
adapter
);
}
...
...
src/vs/editor/browser/standalone/standaloneServices.ts
浏览文件 @
b9189cad
...
...
@@ -38,8 +38,8 @@ import {
}
from
'
vs/editor/browser/standalone/simpleServices
'
;
import
{
ContextKeyService
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
IMenuService
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
Standalone
ColorServiceImpl
}
from
'
vs/editor/browser/services/standaloneColor
ServiceImpl
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
Standalone
ThemeServiceImpl
}
from
'
vs/editor/browser/services/standaloneTheme
ServiceImpl
'
;
export
interface
IEditorContextViewService
extends
IContextViewService
{
dispose
():
void
;
...
...
@@ -139,7 +139,7 @@ export module StaticServices {
export
const
storageService
=
define
(
IStorageService
,
()
=>
NullStorageService
);
export
const
standalone
ColorService
=
define
(
IStandaloneColorService
,
()
=>
new
StandaloneColor
ServiceImpl
());
export
const
standalone
ThemeService
=
define
(
IStandaloneThemeService
,
()
=>
new
StandaloneTheme
ServiceImpl
());
}
export
class
DynamicStandaloneServices
extends
Disposable
{
...
...
src/vs/editor/common/modes/monarch/monarchLexer.ts
浏览文件 @
b9189cad
...
...
@@ -15,7 +15,7 @@ import * as monarchCommon from 'vs/editor/common/modes/monarch/monarchCommon';
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
Token
,
TokenizationResult
,
TokenizationResult2
}
from
'
vs/editor/common/core/token
'
;
import
{
NULL_STATE
,
NULL_MODE_ID
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
TokenTheme
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
const
CACHE_STACK_DEPTH
=
5
;
...
...
@@ -378,15 +378,15 @@ class MonarchModernTokensCollector implements IMonarchTokensCollector {
export
class
MonarchTokenizer
implements
modes
.
ITokenizationSupport
{
private
readonly
_modeService
:
IModeService
;
private
readonly
_standalone
ColorService
:
IStandaloneColor
Service
;
private
readonly
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
readonly
_modeId
:
string
;
private
readonly
_lexer
:
monarchCommon
.
ILexer
;
private
_embeddedModes
:
{
[
modeId
:
string
]:
boolean
;
};
private
_tokenizationRegistryListener
:
IDisposable
;
constructor
(
modeService
:
IModeService
,
standalone
ColorService
:
IStandaloneColor
Service
,
modeId
:
string
,
lexer
:
monarchCommon
.
ILexer
)
{
constructor
(
modeService
:
IModeService
,
standalone
ThemeService
:
IStandaloneTheme
Service
,
modeId
:
string
,
lexer
:
monarchCommon
.
ILexer
)
{
this
.
_modeService
=
modeService
;
this
.
_standalone
ColorService
=
standaloneColor
Service
;
this
.
_standalone
ThemeService
=
standaloneTheme
Service
;
this
.
_modeId
=
modeId
;
this
.
_lexer
=
lexer
;
this
.
_embeddedModes
=
Object
.
create
(
null
);
...
...
@@ -429,7 +429,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
}
public
tokenize2
(
line
:
string
,
lineState
:
modes
.
IState
,
offsetDelta
:
number
):
TokenizationResult2
{
let
tokensCollector
=
new
MonarchModernTokensCollector
(
this
.
_modeService
,
this
.
_standalone
Color
Service
.
getTheme
().
tokenTheme
);
let
tokensCollector
=
new
MonarchModernTokensCollector
(
this
.
_modeService
,
this
.
_standalone
Theme
Service
.
getTheme
().
tokenTheme
);
let
endLineState
=
this
.
_tokenize
(
line
,
<
MonarchLineState
>
lineState
,
offsetDelta
,
tokensCollector
);
return
tokensCollector
.
finalize
(
endLineState
);
}
...
...
@@ -836,6 +836,6 @@ function findBracket(lexer: monarchCommon.ILexer, matched: string) {
return
null
;
}
export
function
createTokenizationSupport
(
modeService
:
IModeService
,
standalone
ColorService
:
IStandaloneColor
Service
,
modeId
:
string
,
lexer
:
monarchCommon
.
ILexer
):
modes
.
ITokenizationSupport
{
return
new
MonarchTokenizer
(
modeService
,
standalone
Color
Service
,
modeId
,
lexer
);
export
function
createTokenizationSupport
(
modeService
:
IModeService
,
standalone
ThemeService
:
IStandaloneTheme
Service
,
modeId
:
string
,
lexer
:
monarchCommon
.
ILexer
):
modes
.
ITokenizationSupport
{
return
new
MonarchTokenizer
(
modeService
,
standalone
Theme
Service
,
modeId
,
lexer
);
}
src/vs/editor/common/services/standalone
Color
Service.ts
→
src/vs/editor/common/services/standalone
Theme
Service.ts
浏览文件 @
b9189cad
...
...
@@ -6,9 +6,9 @@
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TokenTheme
,
ITokenThemeRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
ITheme
}
from
"
vs/platform/theme/common/themeService
"
;
import
{
ITheme
,
IThemeService
}
from
"
vs/platform/theme/common/themeService
"
;
export
var
IStandalone
ColorService
=
createDecorator
<
IStandaloneColorService
>
(
'
standaloneColor
Service
'
);
export
var
IStandalone
ThemeService
=
createDecorator
<
IStandaloneThemeService
>
(
'
theme
Service
'
);
export
type
BuiltinTheme
=
'
vs
'
|
'
vs-dark
'
|
'
hc-black
'
;
export
type
IColors
=
{
[
colorId
:
string
]:
string
;
};
...
...
@@ -24,7 +24,7 @@ export interface IStandaloneTheme extends ITheme {
tokenTheme
:
TokenTheme
;
}
export
interface
IStandalone
Color
Service
{
export
interface
IStandalone
ThemeService
extends
ITheme
Service
{
_serviceBrand
:
any
;
setTheme
(
themeName
:
string
):
string
;
...
...
src/vs/editor/common/standalone/themes.ts
浏览文件 @
b9189cad
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
IStandaloneThemeData
}
from
"
vs/editor/common/services/standalone
Color
Service
"
;
import
{
IStandaloneThemeData
}
from
"
vs/editor/common/services/standalone
Theme
Service
"
;
/* -------------------------------- Begin vs theme -------------------------------- */
export
const
vs
:
IStandaloneThemeData
=
{
...
...
@@ -68,7 +68,7 @@ export const vs: IStandaloneThemeData = {
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
],
colors
:
{
editorBackground
:
'
#FFFFF
F
'
,
editorBackground
:
'
#FFFFF
E
'
,
editorForeground
:
'
#000000
'
,
editorInactiveSelection
:
'
#E5EBF1
'
,
editorGuide
:
'
#D3D3D3
'
,
...
...
src/vs/editor/contrib/inspectTokens/browser/inspectTokens.ts
浏览文件 @
b9189cad
...
...
@@ -17,7 +17,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import
{
TokenMetadata
}
from
'
vs/editor/common/model/tokensBinaryEncoding
'
;
import
{
TokenizationRegistry
,
LanguageIdentifier
,
FontStyle
,
StandardTokenType
,
ITokenizationSupport
,
IState
}
from
'
vs/editor/common/modes
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
IStandalone
ColorService
}
from
'
vs/editor/common/services/standaloneColor
Service
'
;
import
{
IStandalone
ThemeService
}
from
'
vs/editor/common/services/standaloneTheme
Service
'
;
import
{
NULL_STATE
,
nullTokenize
,
nullTokenize2
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
Token
}
from
'
vs/editor/common/core/token
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
...
...
@@ -32,18 +32,18 @@ class InspectTokensController extends Disposable implements IEditorContribution
}
private
_editor
:
ICodeEditor
;
private
_standalone
ColorService
:
IStandaloneColor
Service
;
private
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
_modeService
:
IModeService
;
private
_widget
:
InspectTokensWidget
;
constructor
(
editor
:
ICodeEditor
,
@
IStandalone
ColorService
standaloneColorService
:
IStandaloneColor
Service
,
@
IStandalone
ThemeService
standaloneColorService
:
IStandaloneTheme
Service
,
@
IModeService
modeService
:
IModeService
)
{
super
();
this
.
_editor
=
editor
;
this
.
_standalone
Color
Service
=
standaloneColorService
;
this
.
_standalone
Theme
Service
=
standaloneColorService
;
this
.
_modeService
=
modeService
;
this
.
_widget
=
null
;
...
...
@@ -68,7 +68,7 @@ class InspectTokensController extends Disposable implements IEditorContribution
if
(
!
this
.
_editor
.
getModel
())
{
return
;
}
this
.
_widget
=
new
InspectTokensWidget
(
this
.
_editor
,
this
.
_standalone
Color
Service
,
this
.
_modeService
);
this
.
_widget
=
new
InspectTokensWidget
(
this
.
_editor
,
this
.
_standalone
Theme
Service
,
this
.
_modeService
);
}
public
stop
():
void
{
...
...
@@ -166,7 +166,7 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
public
allowEditorOverflow
=
true
;
private
_editor
:
ICodeEditor
;
private
_standalone
ColorService
:
IStandaloneColor
Service
;
private
_standalone
ThemeService
:
IStandaloneTheme
Service
;
private
_modeService
:
IModeService
;
private
_tokenizationSupport
:
ITokenizationSupport
;
private
_model
:
IModel
;
...
...
@@ -174,12 +174,12 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
constructor
(
editor
:
ICodeEditor
,
standalone
ColorService
:
IStandaloneColor
Service
,
standalone
ThemeService
:
IStandaloneTheme
Service
,
modeService
:
IModeService
)
{
super
();
this
.
_editor
=
editor
;
this
.
_standalone
ColorService
=
standaloneColor
Service
;
this
.
_standalone
ThemeService
=
standaloneTheme
Service
;
this
.
_modeService
=
modeService
;
this
.
_model
=
this
.
_editor
.
getModel
();
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录