Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
86af8bfa
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,发现更多精彩内容 >>
未验证
提交
86af8bfa
编写于
3月 26, 2018
作者:
M
Martin Aeschlimann
提交者:
GitHub
3月 26, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #46117 from Microsoft/octref/cssFolding
[WIP] CSS Folding
上级
addd44d6
2ad387e5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
69 addition
and
22 deletion
+69
-22
extensions/css-language-features/client/src/cssMain.ts
extensions/css-language-features/client/src/cssMain.ts
+20
-1
extensions/css-language-features/client/tsconfig.json
extensions/css-language-features/client/tsconfig.json
+1
-0
extensions/css-language-features/package.json
extensions/css-language-features/package.json
+4
-3
extensions/css-language-features/server/package.json
extensions/css-language-features/server/package.json
+2
-1
extensions/css-language-features/server/src/cssServerMain.ts
extensions/css-language-features/server/src/cssServerMain.ts
+13
-2
extensions/css-language-features/server/yarn.lock
extensions/css-language-features/server/yarn.lock
+7
-0
extensions/css-language-features/yarn.lock
extensions/css-language-features/yarn.lock
+22
-15
未找到文件。
extensions/css-language-features/client/src/cssMain.ts
浏览文件 @
86af8bfa
...
...
@@ -8,8 +8,9 @@ import * as path from 'path';
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
}
from
'
vscode
'
;
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
TextDocument
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
,
FoldingRangeList
,
FoldingRange
,
FoldingContext
,
CancellationToken
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
}
from
'
vscode-languageclient
'
;
import
{
FoldingRangesRequest
,
FoldingRangeRequestParam
}
from
'
vscode-languageserver-protocol-foldingprovider
'
;
// this method is called when vs code is activated
export
function
activate
(
context
:
ExtensionContext
)
{
...
...
@@ -92,6 +93,24 @@ export function activate(context: ExtensionContext) {
}
});
languages
.
registerFoldingProvider
(
documentSelector
,
{
provideFoldingRanges
(
document
:
TextDocument
,
context
:
FoldingContext
,
token
:
CancellationToken
)
{
const
param
:
FoldingRangeRequestParam
=
{
textDocument
:
client
.
code2ProtocolConverter
.
asTextDocumentIdentifier
(
document
),
maxRanges
:
context
.
maxRanges
};
return
client
.
sendRequest
(
FoldingRangesRequest
.
type
,
param
,
token
).
then
(
res
=>
{
if
(
res
&&
Array
.
isArray
(
res
.
ranges
))
{
return
new
FoldingRangeList
(
res
.
ranges
.
map
(
r
=>
new
FoldingRange
(
r
.
startLine
,
r
.
endLine
,
r
.
type
)));
}
return
null
;
},
error
=>
{
client
.
logFailedRequest
(
FoldingRangesRequest
.
type
,
error
);
return
null
;
});
}
});
commands
.
registerCommand
(
'
_css.applyCodeAction
'
,
applyCodeAction
);
function
applyCodeAction
(
uri
:
string
,
documentVersion
:
number
,
edits
:
TextEdit
[])
{
...
...
extensions/css-language-features/client/tsconfig.json
浏览文件 @
86af8bfa
...
...
@@ -4,6 +4,7 @@
"module"
:
"commonjs"
,
"outDir"
:
"./out"
,
"noUnusedLocals"
:
true
,
"sourceMap"
:
true
,
"lib"
:
[
"es2016"
],
...
...
extensions/css-language-features/package.json
浏览文件 @
86af8bfa
{
"name"
:
"css-language-features"
,
"displayName"
:
"%displayName%"
,
"description"
:
"%description%"
,
"displayName"
:
"%displayName%"
,
"description"
:
"%description%"
,
"version"
:
"1.0.0"
,
"publisher"
:
"vscode"
,
"engines"
:
{
...
...
@@ -692,7 +692,8 @@
]
},
"dependencies"
:
{
"vscode-languageclient"
:
"4.0.0-next.9"
,
"vscode-languageclient"
:
"^4.0.0"
,
"vscode-languageserver-protocol-foldingprovider"
:
"^1.0.1"
,
"vscode-nls"
:
"^3.2.1"
},
"devDependencies"
:
{
...
...
extensions/css-language-features/server/package.json
浏览文件 @
86af8bfa
...
...
@@ -10,7 +10,8 @@
"dependencies"
:
{
"vscode-css-languageservice"
:
"^3.0.9-next.1"
,
"vscode-emmet-helper"
:
"^1.2.0"
,
"vscode-languageserver"
:
"^4.0.0"
"vscode-languageserver"
:
"^4.0.0"
,
"vscode-languageserver-protocol-foldingprovider"
:
"^1.0.1"
},
"devDependencies"
:
{
"@types/mocha"
:
"2.2.33"
,
...
...
extensions/css-language-features/server/src/cssServerMain.ts
浏览文件 @
86af8bfa
...
...
@@ -16,6 +16,7 @@ import { getLanguageModelCache } from './languageModelCache';
import
{
formatError
,
runSafe
}
from
'
./utils/errors
'
;
import
URI
from
'
vscode-uri
'
;
import
{
getPathCompletionParticipant
}
from
'
./pathCompletion
'
;
import
{
FoldingProviderServerCapabilities
,
FoldingRangesRequest
}
from
'
vscode-languageserver-protocol-foldingprovider
'
;
export
interface
Settings
{
css
:
LanguageSettings
;
...
...
@@ -72,7 +73,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
}
let
snippetSupport
=
hasClientCapability
(
'
textDocument.completion.completionItem.snippetSupport
'
);
scopedSettingsSupport
=
hasClientCapability
(
'
workspace.configuration
'
);
let
capabilities
:
ServerCapabilities
=
{
let
capabilities
:
ServerCapabilities
&
FoldingProviderServerCapabilities
=
{
// Tell the client that the server works in FULL text document sync mode
textDocumentSync
:
documents
.
syncKind
,
completionProvider
:
snippetSupport
?
{
resolveProvider
:
false
}
:
undefined
,
...
...
@@ -83,7 +85,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
documentHighlightProvider
:
true
,
codeActionProvider
:
true
,
renameProvider
:
true
,
colorProvider
:
true
colorProvider
:
true
,
foldingProvider
:
true
};
return
{
capabilities
};
});
...
...
@@ -274,5 +277,13 @@ connection.onRenameRequest(renameParameters => {
},
null
,
`Error while computing renames for
${
renameParameters
.
textDocument
.
uri
}
`
);
});
connection
.
onRequest
(
FoldingRangesRequest
.
type
,
(
params
,
token
)
=>
{
return
runSafe
(()
=>
{
let
document
=
documents
.
get
(
params
[
0
].
textDocument
.
uri
);
let
stylesheet
=
stylesheets
.
get
(
document
);
return
getLanguageService
(
document
).
findFoldingRegions
(
document
,
stylesheet
);
},
null
,
`Error while computing folding ranges for
${
params
[
0
].
textDocument
.
uri
}
`
);
});
// Listen on the connection
connection
.
listen
();
\ No newline at end of file
extensions/css-language-features/server/yarn.lock
浏览文件 @
86af8bfa
...
...
@@ -37,6 +37,13 @@ vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-languageserver-protocol-foldingprovider@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-1.0.1.tgz#85514aaf8fe905e91bf21e4106e0847f60d40f44"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
...
...
extensions/css-language-features/yarn.lock
浏览文件 @
86af8bfa
...
...
@@ -6,26 +6,33 @@
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
vscode-jsonrpc@^3.6.0
-next.1
:
version "3.6.0
-next.1
"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0
-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe
"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0
.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4
"
vscode-languageclient@4.0.0
-next.9
:
version "4.0.0
-next.9
"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0
-next.9.tgz#2a06568f46ee9de3490f85e227d3740a21a03d3a
"
vscode-languageclient@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0
.tgz#635f5bfbcfa1385dae489b394857f1db8b459a7d
"
dependencies:
vscode-languageserver-protocol "^3.6.0
-next.5
"
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol
@^3.6.0-next.5
:
version "
3.6.0-next.5
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol
/-/vscode-languageserver-protocol-3.6.0-next.5.tgz#ed2ec2db759826f753c0a13977dfb2bedc4d31b3
"
vscode-languageserver-protocol
-foldingprovider@^1.0.1
:
version "
1.0.1
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol
-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-1.0.1.tgz#85514aaf8fe905e91bf21e4106e0847f60d40f44
"
dependencies:
vscode-
jsonrpc "^3.6.0-next.1
"
vscode-languageserver-types "^3.6.0
-next.1
"
vscode-
languageserver-protocol "^3.6.0
"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-types@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-types@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-nls@^3.2.1:
version "3.2.1"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录