Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
07be58bb
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,发现更多精彩内容 >>
提交
07be58bb
编写于
12月 03, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add proposed api for smart select, #63935
上级
c98725aa
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
63 addition
and
4 deletion
+63
-4
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-1
src/vs/editor/contrib/smartSelect/smartSelect.ts
src/vs/editor/contrib/smartSelect/smartSelect.ts
+1
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+12
-0
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+10
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+3
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+2
-0
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+33
-1
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
07be58bb
...
...
@@ -1036,7 +1036,7 @@ export interface SelectionRangeProvider {
/**
* Provide ranges that should be selected from the given position.
*/
provideSelectionRanges
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Range
[]
>
;
provideSelectionRanges
(
model
:
model
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
I
Range
[]
>
;
}
export
interface
FoldingContext
{
...
...
src/vs/editor/contrib/smartSelect/smartSelect.ts
浏览文件 @
07be58bb
...
...
@@ -223,7 +223,7 @@ export function provideSelectionRanges(model: ITextModel, position: Position, to
if
(
arrays
.
isNonEmptyArray
(
res
))
{
for
(
const
range
of
res
)
{
if
(
Range
.
isIRange
(
range
)
&&
Range
.
containsPosition
(
range
,
position
))
{
ranges
.
push
({
range
,
rank
});
ranges
.
push
({
range
:
Range
.
lift
(
range
)
,
rank
});
}
}
}
...
...
src/vs/monaco.d.ts
浏览文件 @
07be58bb
...
...
@@ -5303,7 +5303,7 @@ declare namespace monaco.languages {
/**
* Provide ranges that should be selected from the given position.
*/
provideSelectionRanges
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Range
[]
>
;
provideSelectionRanges
(
model
:
editor
.
ITextModel
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
I
Range
[]
>
;
}
export
interface
FoldingContext
{
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
07be58bb
...
...
@@ -20,6 +20,18 @@ declare module 'vscode' {
export
function
sampleFunction
():
Thenable
<
any
>
;
}
//#region Joh - selection range provider
export
interface
SelectionRangeProvider
{
provideSelectionRanges
(
document
:
TextDocument
,
position
:
Position
,
token
:
CancellationToken
):
ProviderResult
<
Range
[]
>
;
}
export
namespace
languages
{
export
function
registerSelectionRangeProvider
(
selector
:
DocumentSelector
,
provider
:
SelectionRangeProvider
):
Disposable
;
}
//#endregion
//#region Joh - read/write in chunks
export
interface
FileSystemProvider
{
...
...
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
07be58bb
...
...
@@ -379,6 +379,16 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
});
}
// -- smart select
$registerSelectionRangeProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
SelectionRangeRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
{
provideSelectionRanges
:
(
model
,
position
,
token
)
=>
{
return
this
.
_proxy
.
$provideSelectionRanges
(
handle
,
model
.
uri
,
position
,
token
);
}
});
}
// --- configuration
private
static
_reviveRegExp
(
regExp
:
ISerializedRegExp
):
RegExp
{
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
07be58bb
...
...
@@ -354,6 +354,9 @@ export function createApiFactory(
registerFoldingRangeProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
FoldingRangeProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerFoldingRangeProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerSelectionRangeProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
SelectionRangeProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerSelectionRangeProvider
(
extension
,
selector
,
provider
);
},
setLanguageConfiguration
:
(
language
:
string
,
configuration
:
vscode
.
LanguageConfiguration
):
vscode
.
Disposable
=>
{
return
extHostLanguageFeatures
.
setLanguageConfiguration
(
language
,
configuration
);
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
07be58bb
...
...
@@ -308,6 +308,7 @@ export interface MainThreadLanguageFeaturesShape extends IDisposable {
$registerDocumentLinkProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
;
$registerDocumentColorProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
;
$registerFoldingRangeProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
;
$registerSelectionRangeProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
;
$setLanguageConfiguration
(
handle
:
number
,
languageId
:
string
,
configuration
:
ISerializedLanguageConfiguration
):
void
;
}
...
...
@@ -885,6 +886,7 @@ export interface ExtHostLanguageFeaturesShape {
$provideDocumentColors
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenable
<
IRawColorInfo
[]
>
;
$provideColorPresentations
(
handle
:
number
,
resource
:
UriComponents
,
colorInfo
:
IRawColorInfo
,
token
:
CancellationToken
):
Thenable
<
modes
.
IColorPresentation
[]
>
;
$provideFoldingRanges
(
handle
:
number
,
resource
:
UriComponents
,
context
:
modes
.
FoldingContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
FoldingRange
[]
>
;
$provideSelectionRanges
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenable
<
IRange
[]
>
;
}
export
interface
ExtHostQuickOpenShape
{
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
07be58bb
...
...
@@ -850,11 +850,31 @@ class FoldingProviderAdapter {
}
}
class
SelectionRangeAdapter
{
constructor
(
private
readonly
_documents
:
ExtHostDocuments
,
private
readonly
_provider
:
vscode
.
SelectionRangeProvider
)
{
}
provideSelectionRanges
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
IRange
[]
>
{
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asThenable
(()
=>
this
.
_provider
.
provideSelectionRanges
(
document
,
pos
,
token
)).
then
(
ranges
=>
{
if
(
isNonEmptyArray
(
ranges
))
{
return
ranges
.
map
(
typeConvert
.
Range
.
from
);
}
else
{
return
undefined
;
}
});
}
}
type
Adapter
=
OutlineAdapter
|
CodeLensAdapter
|
DefinitionAdapter
|
HoverAdapter
|
DocumentHighlightAdapter
|
ReferenceAdapter
|
CodeActionAdapter
|
DocumentFormattingAdapter
|
RangeFormattingAdapter
|
OnTypeFormattingAdapter
|
NavigateTypeAdapter
|
RenameAdapter
|
SuggestAdapter
|
SignatureHelpAdapter
|
LinkProviderAdapter
|
ImplementationAdapter
|
TypeDefinitionAdapter
|
ColorProviderAdapter
|
FoldingProviderAdapter
|
DeclarationAdapter
;
|
ColorProviderAdapter
|
FoldingProviderAdapter
|
DeclarationAdapter
|
SelectionRangeAdapter
;
class
AdapterData
{
constructor
(
...
...
@@ -1248,6 +1268,18 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
FoldingProviderAdapter
,
adapter
=>
adapter
.
provideFoldingRanges
(
URI
.
revive
(
resource
),
context
,
token
));
}
// --- smart select
registerSelectionRangeProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
SelectionRangeProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
SelectionRangeAdapter
(
this
.
_documents
,
provider
),
extension
);
this
.
_proxy
.
$registerSelectionRangeProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
$provideSelectionRanges
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenable
<
IRange
[]
>
{
return
this
.
_withAdapter
(
handle
,
SelectionRangeAdapter
,
adapter
=>
adapter
.
provideSelectionRanges
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- configuration
private
static
_serializeRegExp
(
regExp
:
RegExp
):
ISerializedRegExp
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录