Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bd57ca70
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,发现更多精彩内容 >>
提交
bd57ca70
编写于
7月 18, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Expand Selection not working as intended. Fixes #77194. Fixes #77087
上级
7ec1707a
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
11 addition
and
70 deletion
+11
-70
extensions/css-language-features/client/src/cssMain.ts
extensions/css-language-features/client/src/cssMain.ts
+1
-21
extensions/css-language-features/server/src/cssServerMain.ts
extensions/css-language-features/server/src/cssServerMain.ts
+3
-3
extensions/html-language-features/client/src/htmlMain.ts
extensions/html-language-features/client/src/htmlMain.ts
+1
-21
extensions/html-language-features/server/src/htmlServerMain.ts
...sions/html-language-features/server/src/htmlServerMain.ts
+3
-3
extensions/json-language-features/client/src/jsonMain.ts
extensions/json-language-features/client/src/jsonMain.ts
+1
-21
extensions/json-language-features/server/src/jsonServerMain.ts
...sions/json-language-features/server/src/jsonServerMain.ts
+2
-1
未找到文件。
extensions/css-language-features/client/src/cssMain.ts
浏览文件 @
bd57ca70
...
...
@@ -9,7 +9,7 @@ import * as fs from 'fs';
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
,
workspace
,
TextDocument
,
SelectionRange
}
from
'
vscode
'
;
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
,
workspace
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
Disposable
}
from
'
vscode-languageclient
'
;
import
{
getCustomDataPathsInAllWorkspaces
,
getCustomDataPathsFromAllExtensions
}
from
'
./customData
'
;
...
...
@@ -78,26 +78,6 @@ export function activate(context: ExtensionContext) {
client
.
onReady
().
then
(()
=>
{
context
.
subscriptions
.
push
(
initCompletionProvider
());
documentSelector
.
forEach
(
selector
=>
{
context
.
subscriptions
.
push
(
languages
.
registerSelectionRangeProvider
(
selector
,
{
async
provideSelectionRanges
(
document
:
TextDocument
,
positions
:
Position
[]):
Promise
<
SelectionRange
[]
>
{
const
textDocument
=
client
.
code2ProtocolConverter
.
asTextDocumentIdentifier
(
document
);
const
rawResult
=
await
client
.
sendRequest
<
SelectionRange
[][]
>
(
'
$/textDocument/selectionRanges
'
,
{
textDocument
,
positions
:
positions
.
map
(
client
.
code2ProtocolConverter
.
asPosition
)
});
if
(
Array
.
isArray
(
rawResult
))
{
return
rawResult
.
map
(
rawSelectionRanges
=>
{
return
rawSelectionRanges
.
reduceRight
((
parent
:
SelectionRange
|
undefined
,
selectionRange
:
SelectionRange
)
=>
{
return
{
range
:
client
.
protocol2CodeConverter
.
asRange
(
selectionRange
.
range
),
parent
};
},
undefined
)
!
;
});
}
return
[];
}
}));
});
});
function
initCompletionProvider
():
Disposable
{
...
...
extensions/css-language-features/server/src/cssServerMain.ts
浏览文件 @
bd57ca70
...
...
@@ -374,7 +374,7 @@ connection.onFoldingRanges((params, token) => {
},
null
,
`Error while computing folding ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
});
connection
.
on
Request
(
'
$/textDocument/selectionRanges
'
,
async
(
params
,
token
)
=>
{
connection
.
on
SelectionRanges
(
(
params
,
token
)
=>
{
return
runSafe
(()
=>
{
const
document
=
documents
.
get
(
params
.
textDocument
.
uri
);
const
positions
:
Position
[]
=
params
.
positions
;
...
...
@@ -383,8 +383,8 @@ connection.onRequest('$/textDocument/selectionRanges', async (params, token) =>
const
stylesheet
=
stylesheets
.
get
(
document
);
return
getLanguageService
(
document
).
getSelectionRanges
(
document
,
positions
,
stylesheet
);
}
return
Promise
.
resolve
(
null
)
;
},
null
,
`Error while computing selection ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
return
[]
;
},
[]
,
`Error while computing selection ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
});
...
...
extensions/html-language-features/client/src/htmlMain.ts
浏览文件 @
bd57ca70
...
...
@@ -8,7 +8,7 @@ import * as fs from 'fs';
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
import
{
languages
,
ExtensionContext
,
IndentAction
,
Position
,
TextDocument
,
Range
,
CompletionItem
,
CompletionItemKind
,
SnippetString
,
workspace
,
SelectionRange
}
from
'
vscode
'
;
import
{
languages
,
ExtensionContext
,
IndentAction
,
Position
,
TextDocument
,
Range
,
CompletionItem
,
CompletionItemKind
,
SnippetString
,
workspace
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
RequestType
,
TextDocumentPositionParams
}
from
'
vscode-languageclient
'
;
import
{
EMPTY_ELEMENTS
}
from
'
./htmlEmptyTagsShared
'
;
import
{
activateTagClosing
}
from
'
./tagClosing
'
;
...
...
@@ -87,26 +87,6 @@ export function activate(context: ExtensionContext) {
}
});
toDispose
.
push
(
disposable
);
documentSelector
.
forEach
(
selector
=>
{
context
.
subscriptions
.
push
(
languages
.
registerSelectionRangeProvider
(
selector
,
{
async
provideSelectionRanges
(
document
:
TextDocument
,
positions
:
Position
[]):
Promise
<
SelectionRange
[]
>
{
const
textDocument
=
client
.
code2ProtocolConverter
.
asTextDocumentIdentifier
(
document
);
const
rawResult
=
await
client
.
sendRequest
<
SelectionRange
[][]
>
(
'
$/textDocument/selectionRanges
'
,
{
textDocument
,
positions
:
positions
.
map
(
client
.
code2ProtocolConverter
.
asPosition
)
});
if
(
Array
.
isArray
(
rawResult
))
{
return
rawResult
.
map
(
rawSelectionRanges
=>
{
return
rawSelectionRanges
.
reduceRight
((
parent
:
SelectionRange
|
undefined
,
selectionRange
:
SelectionRange
)
=>
{
return
{
range
:
client
.
protocol2CodeConverter
.
asRange
(
selectionRange
.
range
),
parent
};
},
undefined
)
!
;
});
}
return
[];
}
}));
});
});
languages
.
setLanguageConfiguration
(
'
html
'
,
{
...
...
extensions/html-language-features/server/src/htmlServerMain.ts
浏览文件 @
bd57ca70
...
...
@@ -454,7 +454,7 @@ connection.onFoldingRanges((params, token) => {
},
null
,
`Error while computing folding regions for
${
params
.
textDocument
.
uri
}
`
,
token
);
});
connection
.
on
Request
(
'
$/textDocument/selectionRanges
'
,
async
(
params
,
token
)
=>
{
connection
.
on
SelectionRanges
(
(
params
,
token
)
=>
{
return
runSafe
(()
=>
{
const
document
=
documents
.
get
(
params
.
textDocument
.
uri
);
const
positions
:
Position
[]
=
params
.
positions
;
...
...
@@ -465,8 +465,8 @@ connection.onRequest('$/textDocument/selectionRanges', async (params, token) =>
return
htmlMode
.
getSelectionRanges
(
document
,
positions
);
}
}
return
Promise
.
resolve
(
null
)
;
},
null
,
`Error while computing selection ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
return
[]
;
},
[]
,
`Error while computing selection ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
});
...
...
extensions/json-language-features/client/src/jsonMain.ts
浏览文件 @
bd57ca70
...
...
@@ -10,7 +10,7 @@ import { xhr, XHRResponse, getErrorStatusDescription } from 'request-light';
const
localize
=
nls
.
loadMessageBundle
();
import
{
workspace
,
window
,
languages
,
commands
,
ExtensionContext
,
extensions
,
Uri
,
LanguageConfiguration
,
Diagnostic
,
StatusBarAlignment
,
TextEditor
,
TextDocument
,
Position
,
SelectionRange
}
from
'
vscode
'
;
import
{
workspace
,
window
,
languages
,
commands
,
ExtensionContext
,
extensions
,
Uri
,
LanguageConfiguration
,
Diagnostic
,
StatusBarAlignment
,
TextEditor
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
RequestType
,
ServerOptions
,
TransportKind
,
NotificationType
,
DidChangeConfigurationNotification
,
HandleDiagnosticsSignature
,
ResponseError
}
from
'
vscode-languageclient
'
;
import
TelemetryReporter
from
'
vscode-extension-telemetry
'
;
...
...
@@ -216,26 +216,6 @@ export function activate(context: ExtensionContext) {
extensions
.
onDidChange
(
_
=>
{
client
.
sendNotification
(
SchemaAssociationNotification
.
type
,
getSchemaAssociation
(
context
));
});
documentSelector
.
forEach
(
selector
=>
{
toDispose
.
push
(
languages
.
registerSelectionRangeProvider
(
selector
,
{
async
provideSelectionRanges
(
document
:
TextDocument
,
positions
:
Position
[]):
Promise
<
SelectionRange
[]
>
{
const
textDocument
=
client
.
code2ProtocolConverter
.
asTextDocumentIdentifier
(
document
);
const
rawResult
=
await
client
.
sendRequest
<
SelectionRange
[][]
>
(
'
$/textDocument/selectionRanges
'
,
{
textDocument
,
positions
:
positions
.
map
(
client
.
code2ProtocolConverter
.
asPosition
)
});
if
(
Array
.
isArray
(
rawResult
))
{
return
rawResult
.
map
(
rawSelectionRanges
=>
{
return
rawSelectionRanges
.
reduceRight
((
parent
:
SelectionRange
|
undefined
,
selectionRange
:
SelectionRange
)
=>
{
return
{
range
:
client
.
protocol2CodeConverter
.
asRange
(
selectionRange
.
range
),
parent
,
};
},
undefined
)
!
;
});
}
return
[];
}
}));
});
});
...
...
extensions/json-language-features/server/src/jsonServerMain.ts
浏览文件 @
bd57ca70
...
...
@@ -433,7 +433,8 @@ connection.onFoldingRanges((params, token) => {
},
null
,
`Error while computing folding ranges for
${
params
.
textDocument
.
uri
}
`
,
token
);
});
connection
.
onRequest
(
'
$/textDocument/selectionRanges
'
,
async
(
params
,
token
)
=>
{
connection
.
onSelectionRanges
((
params
,
token
)
=>
{
return
runSafe
(()
=>
{
const
document
=
documents
.
get
(
params
.
textDocument
.
uri
);
if
(
document
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录