Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
38f0dea2
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,发现更多精彩内容 >>
提交
38f0dea2
编写于
7月 11, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #29469, remove unsued code
上级
2ae81ab6
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
49 addition
and
69 deletion
+49
-69
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-8
src/vs/editor/contrib/quickFix/browser/quickFix.ts
src/vs/editor/contrib/quickFix/browser/quickFix.ts
+8
-4
src/vs/editor/contrib/quickFix/browser/quickFixCommands.ts
src/vs/editor/contrib/quickFix/browser/quickFixCommands.ts
+1
-24
src/vs/editor/contrib/quickFix/browser/quickFixModel.ts
src/vs/editor/contrib/quickFix/browser/quickFixModel.ts
+2
-2
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
+3
-3
src/vs/editor/contrib/quickFix/test/browser/quickFixModel.test.ts
...ditor/contrib/quickFix/test/browser/quickFixModel.test.ts
+1
-1
src/vs/editor/standalone/browser/standaloneLanguages.ts
src/vs/editor/standalone/browser/standaloneLanguages.ts
+2
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-9
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+1
-1
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostApiCommands.ts
src/vs/workbench/api/node/extHostApiCommands.ts
+2
-2
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+3
-8
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+23
-4
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
38f0dea2
...
@@ -258,13 +258,6 @@ export interface ISuggestSupport {
...
@@ -258,13 +258,6 @@ export interface ISuggestSupport {
resolveCompletionItem
?(
model
:
editorCommon
.
IModel
,
position
:
Position
,
item
:
ISuggestion
,
token
:
CancellationToken
):
ISuggestion
|
Thenable
<
ISuggestion
>
;
resolveCompletionItem
?(
model
:
editorCommon
.
IModel
,
position
:
Position
,
item
:
ISuggestion
,
token
:
CancellationToken
):
ISuggestion
|
Thenable
<
ISuggestion
>
;
}
}
/**
* Interface used to quick fix typing errors while accesing member fields.
*/
export
interface
CodeAction
{
command
:
Command
;
score
:
number
;
}
/**
/**
* The code action interface defines the contract between extensions and
* The code action interface defines the contract between extensions and
* the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
* the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
...
@@ -274,7 +267,7 @@ export interface CodeActionProvider {
...
@@ -274,7 +267,7 @@ export interface CodeActionProvider {
/**
/**
* Provide commands for the given document and range.
* Provide commands for the given document and range.
*/
*/
provideCodeActions
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
token
:
CancellationToken
):
Co
deAction
[]
|
Thenable
<
CodeAction
[]
>
;
provideCodeActions
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
token
:
CancellationToken
):
Co
mmand
[]
|
Thenable
<
Command
[]
>
;
}
}
/**
/**
...
...
src/vs/editor/contrib/quickFix/browser/quickFix.ts
浏览文件 @
38f0dea2
...
@@ -7,20 +7,24 @@
...
@@ -7,20 +7,24 @@
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Co
deAction
,
CodeActionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Co
mmand
,
CodeActionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
onUnexpectedExternalError
,
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
onUnexpectedExternalError
,
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
export
function
getCodeActions
(
model
:
IReadOnlyModel
,
range
:
Range
):
TPromise
<
Co
deAction
[]
>
{
export
function
getCodeActions
(
model
:
IReadOnlyModel
,
range
:
Range
):
TPromise
<
Co
mmand
[]
>
{
const
allResults
:
Co
deAction
[]
=
[];
const
allResults
:
Co
mmand
[]
=
[];
const
promises
=
CodeActionProviderRegistry
.
all
(
model
).
map
(
support
=>
{
const
promises
=
CodeActionProviderRegistry
.
all
(
model
).
map
(
support
=>
{
return
asWinJsPromise
(
token
=>
support
.
provideCodeActions
(
model
,
range
,
token
)).
then
(
result
=>
{
return
asWinJsPromise
(
token
=>
support
.
provideCodeActions
(
model
,
range
,
token
)).
then
(
result
=>
{
if
(
Array
.
isArray
(
result
))
{
if
(
Array
.
isArray
(
result
))
{
allResults
.
push
(...
result
);
for
(
const
quickFix
of
result
)
{
if
(
quickFix
)
{
allResults
.
push
(
quickFix
);
}
}
}
}
},
err
=>
{
},
err
=>
{
onUnexpectedExternalError
(
err
);
onUnexpectedExternalError
(
err
);
...
...
src/vs/editor/contrib/quickFix/browser/quickFixCommands.ts
浏览文件 @
38f0dea2
...
@@ -12,16 +12,11 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
...
@@ -12,16 +12,11 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
ContextKeyExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ContextKeyExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
,
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
CodeAction
,
CodeActionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
onUnexpectedExternalError
}
from
'
vs/base/common/errors
'
;
import
{
QuickFixContextMenu
}
from
'
./quickFixWidget
'
;
import
{
QuickFixContextMenu
}
from
'
./quickFixWidget
'
;
import
{
LightBulbWidget
}
from
'
./lightBulbWidget
'
;
import
{
LightBulbWidget
}
from
'
./lightBulbWidget
'
;
import
{
QuickFixModel
,
QuickFixComputeEvent
}
from
'
./quickFixModel
'
;
import
{
QuickFixModel
,
QuickFixComputeEvent
}
from
'
./quickFixModel
'
;
...
@@ -135,21 +130,3 @@ export class QuickFixAction extends EditorAction {
...
@@ -135,21 +130,3 @@ export class QuickFixAction extends EditorAction {
}
}
}
}
}
}
export
function
getCodeActions
(
model
:
IReadOnlyModel
,
range
:
Range
):
TPromise
<
CodeAction
[]
>
{
const
allResults
:
CodeAction
[]
=
[];
const
promises
=
CodeActionProviderRegistry
.
all
(
model
).
map
(
support
=>
{
return
asWinJsPromise
(
token
=>
support
.
provideCodeActions
(
model
,
range
,
token
)).
then
(
result
=>
{
if
(
Array
.
isArray
(
result
))
{
allResults
.
push
(...
result
);
}
},
err
=>
{
onUnexpectedExternalError
(
err
);
});
});
return
TPromise
.
join
(
promises
).
then
(()
=>
allResults
);
}
src/vs/editor/contrib/quickFix/browser/quickFixModel.ts
浏览文件 @
38f0dea2
...
@@ -12,7 +12,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
...
@@ -12,7 +12,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IMarker
,
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IMarker
,
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CodeActionProviderRegistry
,
Co
deAction
}
from
'
vs/editor/common/modes
'
;
import
{
CodeActionProviderRegistry
,
Co
mmand
}
from
'
vs/editor/common/modes
'
;
import
{
getCodeActions
}
from
'
./quickFix
'
;
import
{
getCodeActions
}
from
'
./quickFix
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
...
@@ -126,7 +126,7 @@ export interface QuickFixComputeEvent {
...
@@ -126,7 +126,7 @@ export interface QuickFixComputeEvent {
type
:
'
auto
'
|
'
manual
'
;
type
:
'
auto
'
|
'
manual
'
;
range
:
Range
;
range
:
Range
;
position
:
Position
;
position
:
Position
;
fixes
:
TPromise
<
Co
deAction
[]
>
;
fixes
:
TPromise
<
Co
mmand
[]
>
;
}
}
export
class
QuickFixModel
{
export
class
QuickFixModel
{
...
...
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
浏览文件 @
38f0dea2
...
@@ -10,7 +10,7 @@ import { always } from 'vs/base/common/async';
...
@@ -10,7 +10,7 @@ import { always } from 'vs/base/common/async';
import
{
getDomNodePagePosition
}
from
'
vs/base/browser/dom
'
;
import
{
getDomNodePagePosition
}
from
'
vs/base/browser/dom
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Co
deAction
}
from
'
vs/editor/common/modes
'
;
import
{
Co
mmand
}
from
'
vs/editor/common/modes
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
...
@@ -32,10 +32,10 @@ export class QuickFixContextMenu {
...
@@ -32,10 +32,10 @@ export class QuickFixContextMenu {
this
.
_commandService
=
commandService
;
this
.
_commandService
=
commandService
;
}
}
show
(
fixes
:
TPromise
<
Co
deAction
[]
>
,
at
:
{
x
:
number
;
y
:
number
}
|
Position
)
{
show
(
fixes
:
TPromise
<
Co
mmand
[]
>
,
at
:
{
x
:
number
;
y
:
number
}
|
Position
)
{
const
actions
=
fixes
.
then
(
value
=>
{
const
actions
=
fixes
.
then
(
value
=>
{
return
value
.
map
(
({
command
})
=>
{
return
value
.
map
(
command
=>
{
return
new
Action
(
command
.
id
,
command
.
title
,
undefined
,
true
,
()
=>
{
return
new
Action
(
command
.
id
,
command
.
title
,
undefined
,
true
,
()
=>
{
return
always
(
return
always
(
this
.
_commandService
.
executeCommand
(
command
.
id
,
...
command
.
arguments
),
this
.
_commandService
.
executeCommand
(
command
.
id
,
...
command
.
arguments
),
...
...
src/vs/editor/contrib/quickFix/test/browser/quickFixModel.test.ts
浏览文件 @
38f0dea2
...
@@ -38,7 +38,7 @@ suite('QuickFix', () => {
...
@@ -38,7 +38,7 @@ suite('QuickFix', () => {
setup
(()
=>
{
setup
(()
=>
{
reg
=
CodeActionProviderRegistry
.
register
(
languageIdentifier
.
language
,
{
reg
=
CodeActionProviderRegistry
.
register
(
languageIdentifier
.
language
,
{
provideCodeActions
()
{
provideCodeActions
()
{
return
[{
command
:
{
id
:
'
test-command
'
,
title
:
'
test
'
,
arguments
:
[]
},
score
:
1
}];
return
[{
id
:
'
test-command
'
,
title
:
'
test
'
,
arguments
:
[]
}];
}
}
});
});
markerService
=
new
MarkerService
();
markerService
=
new
MarkerService
();
...
...
src/vs/editor/standalone/browser/standaloneLanguages.ts
浏览文件 @
38f0dea2
...
@@ -329,7 +329,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
...
@@ -329,7 +329,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
*/
*/
export
function
registerCodeActionProvider
(
languageId
:
string
,
provider
:
CodeActionProvider
):
IDisposable
{
export
function
registerCodeActionProvider
(
languageId
:
string
,
provider
:
CodeActionProvider
):
IDisposable
{
return
modes
.
CodeActionProviderRegistry
.
register
(
languageId
,
{
return
modes
.
CodeActionProviderRegistry
.
register
(
languageId
,
{
provideCodeActions
:
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
token
:
CancellationToken
):
modes
.
Co
deAction
[]
|
Thenable
<
modes
.
CodeAction
[]
>
=>
{
provideCodeActions
:
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
token
:
CancellationToken
):
modes
.
Co
mmand
[]
|
Thenable
<
modes
.
Command
[]
>
=>
{
let
markers
=
StaticServices
.
markerService
.
get
().
read
({
resource
:
model
.
uri
}).
filter
(
m
=>
{
let
markers
=
StaticServices
.
markerService
.
get
().
read
({
resource
:
model
.
uri
}).
filter
(
m
=>
{
return
Range
.
areIntersectingOrTouching
(
m
,
range
);
return
Range
.
areIntersectingOrTouching
(
m
,
range
);
});
});
...
@@ -404,7 +404,7 @@ export interface CodeActionProvider {
...
@@ -404,7 +404,7 @@ export interface CodeActionProvider {
/**
/**
* Provide commands for the given document and range.
* Provide commands for the given document and range.
*/
*/
provideCodeActions
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
modes
.
Co
deAction
[]
|
Thenable
<
modes
.
CodeAction
[]
>
;
provideCodeActions
(
model
:
editorCommon
.
IReadOnlyModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
modes
.
Co
mmand
[]
|
Thenable
<
modes
.
Command
[]
>
;
}
}
/**
/**
...
...
src/vs/monaco.d.ts
浏览文件 @
38f0dea2
...
@@ -4050,7 +4050,7 @@ declare module monaco.languages {
...
@@ -4050,7 +4050,7 @@ declare module monaco.languages {
/**
/**
* Provide commands for the given document and range.
* Provide commands for the given document and range.
*/
*/
provideCodeActions
(
model
:
editor
.
IReadOnlyModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
Co
deAction
[]
|
Thenable
<
CodeAction
[]
>
;
provideCodeActions
(
model
:
editor
.
IReadOnlyModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
Co
mmand
[]
|
Thenable
<
Command
[]
>
;
}
}
/**
/**
...
@@ -4425,14 +4425,6 @@ declare module monaco.languages {
...
@@ -4425,14 +4425,6 @@ declare module monaco.languages {
provideHover
(
model
:
editor
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
provideHover
(
model
:
editor
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
}
}
/**
* Interface used to quick fix typing errors while accesing member fields.
*/
export
interface
CodeAction
{
command
:
Command
;
score
:
number
;
}
/**
/**
* Represents a parameter of a callable-signature. A parameter can
* Represents a parameter of a callable-signature. A parameter can
* have a label and a doc-comment.
* have a label and a doc-comment.
...
...
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
38f0dea2
...
@@ -157,7 +157,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
...
@@ -157,7 +157,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerQuickFixSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
$registerQuickFixSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
selector
,
<
modes
.
CodeActionProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
selector
,
<
modes
.
CodeActionProvider
>
{
provideCodeActions
:
(
model
:
IReadOnlyModel
,
range
:
EditorRange
,
token
:
CancellationToken
):
Thenable
<
modes
.
Co
deAction
[]
>
=>
{
provideCodeActions
:
(
model
:
IReadOnlyModel
,
range
:
EditorRange
,
token
:
CancellationToken
):
Thenable
<
modes
.
Co
mmand
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
range
)));
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
range
)));
}
}
});
});
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
38f0dea2
...
@@ -464,7 +464,7 @@ export abstract class ExtHostLanguageFeaturesShape {
...
@@ -464,7 +464,7 @@ export abstract class ExtHostLanguageFeaturesShape {
$provideHover
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
):
TPromise
<
modes
.
Hover
>
{
throw
ni
();
}
$provideHover
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
):
TPromise
<
modes
.
Hover
>
{
throw
ni
();
}
$provideDocumentHighlights
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
):
TPromise
<
modes
.
DocumentHighlight
[]
>
{
throw
ni
();
}
$provideDocumentHighlights
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
):
TPromise
<
modes
.
DocumentHighlight
[]
>
{
throw
ni
();
}
$provideReferences
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
):
TPromise
<
modes
.
Location
[]
>
{
throw
ni
();
}
$provideReferences
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
):
TPromise
<
modes
.
Location
[]
>
{
throw
ni
();
}
$provideCodeActions
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
deAction
[]
>
{
throw
ni
();
}
$provideCodeActions
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
mmand
[]
>
{
throw
ni
();
}
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
URI
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
URI
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
):
TPromise
<
editorCommon
.
ISingleEditOperation
[]
>
{
throw
ni
();
}
...
...
src/vs/workbench/api/node/extHostApiCommands.ts
浏览文件 @
38f0dea2
...
@@ -399,11 +399,11 @@ export class ExtHostApiCommands {
...
@@ -399,11 +399,11 @@ export class ExtHostApiCommands {
resource
,
resource
,
range
:
typeConverters
.
fromRange
(
range
)
range
:
typeConverters
.
fromRange
(
range
)
};
};
return
this
.
_commands
.
executeCommand
<
modes
.
Co
deAction
[]
>
(
'
_executeCodeActionProvider
'
,
args
).
then
(
value
=>
{
return
this
.
_commands
.
executeCommand
<
modes
.
Co
mmand
[]
>
(
'
_executeCodeActionProvider
'
,
args
).
then
(
value
=>
{
if
(
!
Array
.
isArray
(
value
))
{
if
(
!
Array
.
isArray
(
value
))
{
return
undefined
;
return
undefined
;
}
}
return
value
.
map
(
quickFix
=>
this
.
_commands
.
converter
.
fromInternal
(
quickFix
.
command
));
return
value
.
map
(
quickFix
=>
this
.
_commands
.
converter
.
fromInternal
(
quickFix
));
});
});
}
}
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
38f0dea2
...
@@ -271,7 +271,7 @@ class QuickFixAdapter {
...
@@ -271,7 +271,7 @@ class QuickFixAdapter {
this
.
_provider
=
provider
;
this
.
_provider
=
provider
;
}
}
provideCodeActions
(
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
deAction
[]
>
{
provideCodeActions
(
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
mmand
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
ran
=
TypeConverters
.
toRange
(
range
);
const
ran
=
TypeConverters
.
toRange
(
range
);
...
@@ -291,12 +291,7 @@ class QuickFixAdapter {
...
@@ -291,12 +291,7 @@ class QuickFixAdapter {
if
(
!
Array
.
isArray
(
commands
))
{
if
(
!
Array
.
isArray
(
commands
))
{
return
undefined
;
return
undefined
;
}
}
return
commands
.
map
((
command
,
i
)
=>
{
return
commands
.
map
(
command
=>
this
.
_commands
.
toInternal
(
command
));
return
<
modes
.
CodeAction
>
{
command
:
this
.
_commands
.
toInternal
(
command
),
score
:
i
};
});
});
});
}
}
}
}
...
@@ -843,7 +838,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape {
...
@@ -843,7 +838,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
return
this
.
_createDisposable
(
handle
);
}
}
$provideCodeActions
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
deAction
[]
>
{
$provideCodeActions
(
handle
:
number
,
resource
:
URI
,
range
:
IRange
):
TPromise
<
modes
.
Co
mmand
[]
>
{
return
this
.
_withAdapter
(
handle
,
QuickFixAdapter
,
adapter
=>
adapter
.
provideCodeActions
(
resource
,
range
));
return
this
.
_withAdapter
(
handle
,
QuickFixAdapter
,
adapter
=>
adapter
.
provideCodeActions
(
resource
,
range
));
}
}
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
38f0dea2
...
@@ -650,10 +650,29 @@ suite('ExtHostLanguageFeatures', function () {
...
@@ -650,10 +650,29 @@ suite('ExtHostLanguageFeatures', function () {
assert
.
equal
(
value
.
length
,
2
);
assert
.
equal
(
value
.
length
,
2
);
let
[
first
,
second
]
=
value
;
let
[
first
,
second
]
=
value
;
assert
.
equal
(
first
.
command
.
title
,
'
Testing1
'
);
assert
.
equal
(
first
.
title
,
'
Testing1
'
);
assert
.
equal
(
first
.
command
.
id
,
'
test1
'
);
assert
.
equal
(
first
.
id
,
'
test1
'
);
assert
.
equal
(
second
.
command
.
title
,
'
Testing2
'
);
assert
.
equal
(
second
.
title
,
'
Testing2
'
);
assert
.
equal
(
second
.
command
.
id
,
'
test2
'
);
assert
.
equal
(
second
.
id
,
'
test2
'
);
});
});
});
test
(
'
Cannot read property
\'
id
\'
of undefined, #29469
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCodeActionProvider
(
defaultSelector
,
<
vscode
.
CodeActionProvider
>
{
provideCodeActions
():
any
{
return
[
undefined
,
null
,
<
vscode
.
Command
>
{
command
:
'
test
'
,
title
:
'
Testing
'
}
];
}
}));
return
threadService
.
sync
().
then
(()
=>
{
return
getCodeActions
(
model
,
model
.
getFullModelRange
()).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
});
});
});
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录