Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8c3a00f7
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8c3a00f7
编写于
3月 08, 2021
作者:
B
Benjamin Pasero
提交者:
GitHub
3月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
allow debug textmate in sandbox (#118219)
上级
5d80c30e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
43 deletion
+37
-43
src/vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution.ts
...ib/codeEditor/electron-browser/codeEditor.contribution.ts
+0
-6
src/vs/workbench/contrib/codeEditor/electron-sandbox/codeEditor.contribution.ts
...ib/codeEditor/electron-sandbox/codeEditor.contribution.ts
+1
-0
src/vs/workbench/contrib/codeEditor/electron-sandbox/startDebugTextMate.ts
...contrib/codeEditor/electron-sandbox/startDebugTextMate.ts
+36
-34
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+0
-3
未找到文件。
src/vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution.ts
已删除
100644 → 0
浏览文件 @
5d80c30e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
'
./startDebugTextMate
'
;
src/vs/workbench/contrib/codeEditor/electron-sandbox/codeEditor.contribution.ts
浏览文件 @
8c3a00f7
...
...
@@ -7,3 +7,4 @@ import './displayChangeRemeasureFonts';
import
'
./inputClipboardActions
'
;
import
'
./selectionClipboard
'
;
import
'
./sleepResumeRepaintMinimap
'
;
import
'
./startDebugTextMate
'
;
src/vs/workbench/contrib/codeEditor/electron-
browser
/startDebugTextMate.ts
→
src/vs/workbench/contrib/codeEditor/electron-
sandbox
/startDebugTextMate.ts
浏览文件 @
8c3a00f7
...
...
@@ -5,49 +5,42 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
CATEGORIES
,
Extensions
as
ActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
Action2
,
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
CATEGORIES
}
from
'
vs/workbench/common/actions
'
;
import
{
ITextMateService
}
from
'
vs/workbench/services/textMate/common/textMateService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
createRotatingLogger
}
from
'
vs/platform/log/node/spdlogLog
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
Constants
}
from
'
vs/base/common/uint
'
;
import
{
IHostService
}
from
'
vs/workbench/services/host/browser/host
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
INativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-sandbox/environmentService
'
;
import
{
ILoggerService
}
from
'
vs/platform/log/common/log
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
class
StartDebugTextMate
extends
Action
{
class
StartDebugTextMate
extends
Action
2
{
private
static
resource
=
URI
.
parse
(
`inmemory:///tm-log.txt`
);
public
static
readonly
ID
=
'
editor.action.startDebugTextMate
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
startDebugTextMate
'
,
"
Start Text Mate Syntax Grammar Logging
"
);
constructor
(
id
:
string
,
label
:
string
,
@
ITextMateService
private
readonly
_textMateService
:
ITextMateService
,
@
IModelService
private
readonly
_modelService
:
IModelService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
ICodeEditorService
private
readonly
_codeEditorService
:
ICodeEditorService
,
@
IHostService
private
readonly
_hostService
:
IHostService
,
@
INativeWorkbenchEnvironmentService
private
readonly
_environmentService
:
INativeWorkbenchEnvironmentService
)
{
super
(
id
,
label
);
constructor
()
{
super
({
id
:
'
editor.action.startDebugTextMate
'
,
title
:
{
value
:
nls
.
localize
(
'
startDebugTextMate
'
,
"
Start Text Mate Syntax Grammar Logging
"
),
original
:
'
Start Text Mate Syntax Grammar Logging
'
},
category
:
CATEGORIES
.
Developer
.
value
,
f1
:
true
});
}
private
_getOrCreateModel
():
ITextModel
{
const
model
=
this
.
_
modelService
.
getModel
(
StartDebugTextMate
.
resource
);
private
_getOrCreateModel
(
modelService
:
IModelService
):
ITextModel
{
const
model
=
modelService
.
getModel
(
StartDebugTextMate
.
resource
);
if
(
model
)
{
return
model
;
}
return
this
.
_
modelService
.
createModel
(
''
,
null
,
StartDebugTextMate
.
resource
);
return
modelService
.
createModel
(
''
,
null
,
StartDebugTextMate
.
resource
);
}
private
_append
(
model
:
ITextModel
,
str
:
string
)
{
...
...
@@ -58,18 +51,28 @@ class StartDebugTextMate extends Action {
}]);
}
public
async
run
():
Promise
<
any
>
{
const
pathInTemp
=
join
(
this
.
_environmentService
.
tmpDir
.
fsPath
,
`vcode-tm-log-
${
generateUuid
()}
.txt`
);
const
logger
=
createRotatingLogger
(
`tm-log`
,
pathInTemp
,
1024
*
1024
*
30
,
1
);
const
model
=
this
.
_getOrCreateModel
();
async
run
(
accessor
:
ServicesAccessor
)
{
const
textMateService
=
accessor
.
get
(
ITextMateService
);
const
modelService
=
accessor
.
get
(
IModelService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
const
codeEditorService
=
accessor
.
get
(
ICodeEditorService
);
const
hostService
=
accessor
.
get
(
IHostService
);
const
environmentService
=
accessor
.
get
(
INativeWorkbenchEnvironmentService
);
const
loggerService
=
accessor
.
get
(
ILoggerService
);
const
fileService
=
accessor
.
get
(
IFileService
);
const
pathInTemp
=
joinPath
(
environmentService
.
tmpDir
,
`vcode-tm-log-
${
generateUuid
()}
.txt`
);
await
fileService
.
createFile
(
pathInTemp
);
const
logger
=
loggerService
.
createLogger
(
pathInTemp
,
{
name
:
'
debug textmate
'
});
const
model
=
this
.
_getOrCreateModel
(
modelService
);
const
append
=
(
str
:
string
)
=>
{
this
.
_append
(
model
,
str
+
'
\n
'
);
scrollEditor
();
logger
.
info
(
str
);
logger
.
flush
();
};
await
this
.
_hostService
.
openWindow
([{
fileUri
:
URI
.
file
(
pathInTemp
)
}],
{
forceNewWindow
:
true
});
const
textEditorPane
=
await
this
.
_
editorService
.
openEditor
({
await
hostService
.
openWindow
([{
fileUri
:
pathInTemp
}],
{
forceNewWindow
:
true
});
const
textEditorPane
=
await
editorService
.
openEditor
({
resource
:
model
.
uri
,
options
:
{
pinned
:
true
}
});
...
...
@@ -77,7 +80,7 @@ class StartDebugTextMate extends Action {
return
;
}
const
scrollEditor
=
()
=>
{
const
editors
=
this
.
_
codeEditorService
.
listCodeEditors
();
const
editors
=
codeEditorService
.
listCodeEditors
();
for
(
const
editor
of
editors
)
{
if
(
editor
.
hasModel
())
{
if
(
editor
.
getModel
().
uri
.
toString
()
===
StartDebugTextMate
.
resource
.
toString
())
{
...
...
@@ -90,7 +93,7 @@ class StartDebugTextMate extends Action {
append
(
`// Open the file you want to test to the side and watch here`
);
append
(
`// Output mirrored at
${
pathInTemp
}
`
);
t
his
.
_t
extMateService
.
startDebugMode
(
textMateService
.
startDebugMode
(
(
str
)
=>
{
this
.
_append
(
model
,
str
+
'
\n
'
);
scrollEditor
();
...
...
@@ -104,5 +107,4 @@ class StartDebugTextMate extends Action {
}
}
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
from
(
StartDebugTextMate
),
'
Start Text Mate Syntax Grammar Logging
'
,
CATEGORIES
.
Developer
.
value
);
registerAction2
(
StartDebugTextMate
);
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
8c3a00f7
...
...
@@ -125,9 +125,6 @@ import 'vs/workbench/contrib/extensions/electron-browser/extensions.contribution
// Terminal
import
'
vs/workbench/contrib/terminal/electron-browser/terminal.contribution
'
;
// CodeEditor Contributions
import
'
vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution
'
;
// External Terminal
import
'
vs/workbench/contrib/externalTerminal/node/externalTerminal.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录