Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
116948ef
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,发现更多精彩内容 >>
提交
116948ef
编写于
7月 25, 2018
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[css] adopt lsp (folding, colors)
上级
21c22840
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
41 addition
and
107 deletion
+41
-107
extensions/css-language-features/client/src/cssMain.ts
extensions/css-language-features/client/src/cssMain.ts
+1
-50
extensions/css-language-features/package.json
extensions/css-language-features/package.json
+2
-3
extensions/css-language-features/server/package.json
extensions/css-language-features/server/package.json
+2
-3
extensions/css-language-features/server/src/cssServerMain.ts
extensions/css-language-features/server/src/cssServerMain.ts
+2
-3
extensions/css-language-features/server/yarn.lock
extensions/css-language-features/server/yarn.lock
+23
-30
extensions/css-language-features/yarn.lock
extensions/css-language-features/yarn.lock
+11
-18
未找到文件。
extensions/css-language-features/client/src/cssMain.ts
浏览文件 @
116948ef
...
@@ -8,9 +8,8 @@ import * as path from 'path';
...
@@ -8,9 +8,8 @@ import * as path from 'path';
import
*
as
nls
from
'
vscode-nls
'
;
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
const
localize
=
nls
.
loadMessageBundle
();
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
TextDocument
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
,
FoldingRangeKind
,
FoldingRange
,
FoldingContext
,
CancellationToken
}
from
'
vscode
'
;
import
{
languages
,
window
,
commands
,
ExtensionContext
,
Range
,
Position
,
CompletionItem
,
CompletionItemKind
,
TextEdit
,
SnippetString
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
Disposable
}
from
'
vscode-languageclient
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
Disposable
}
from
'
vscode-languageclient
'
;
import
{
FoldingRangeRequest
,
FoldingRangeRequestParam
,
FoldingRangeClientCapabilities
,
FoldingRangeKind
as
LSFoldingRangeKind
}
from
'
vscode-languageserver-protocol-foldingprovider
'
;
// this method is called when vs code is activated
// this method is called when vs code is activated
export
function
activate
(
context
:
ExtensionContext
)
{
export
function
activate
(
context
:
ExtensionContext
)
{
...
@@ -42,21 +41,6 @@ export function activate(context: ExtensionContext) {
...
@@ -42,21 +41,6 @@ export function activate(context: ExtensionContext) {
// Create the language client and start the client.
// Create the language client and start the client.
let
client
=
new
LanguageClient
(
'
css
'
,
localize
(
'
cssserver.name
'
,
'
CSS Language Server
'
),
serverOptions
,
clientOptions
);
let
client
=
new
LanguageClient
(
'
css
'
,
localize
(
'
cssserver.name
'
,
'
CSS Language Server
'
),
serverOptions
,
clientOptions
);
client
.
registerProposedFeatures
();
client
.
registerProposedFeatures
();
client
.
registerFeature
({
fillClientCapabilities
(
capabilities
:
FoldingRangeClientCapabilities
):
void
{
let
textDocumentCap
=
capabilities
.
textDocument
;
if
(
!
textDocumentCap
)
{
textDocumentCap
=
capabilities
.
textDocument
=
{};
}
textDocumentCap
.
foldingRange
=
{
dynamicRegistration
:
false
,
rangeLimit
:
5000
,
lineFoldingOnly
:
true
};
},
initialize
(
capabilities
,
documentSelector
):
void
{
}
});
let
disposable
=
client
.
start
();
let
disposable
=
client
.
start
();
// Push the disposable to the context's subscriptions so that the
// Push the disposable to the context's subscriptions so that the
...
@@ -85,7 +69,6 @@ export function activate(context: ExtensionContext) {
...
@@ -85,7 +69,6 @@ export function activate(context: ExtensionContext) {
client
.
onReady
().
then
(()
=>
{
client
.
onReady
().
then
(()
=>
{
context
.
subscriptions
.
push
(
initCompletionProvider
());
context
.
subscriptions
.
push
(
initCompletionProvider
());
context
.
subscriptions
.
push
(
initFoldingProvider
());
});
});
function
initCompletionProvider
():
Disposable
{
function
initCompletionProvider
():
Disposable
{
...
@@ -116,38 +99,6 @@ export function activate(context: ExtensionContext) {
...
@@ -116,38 +99,6 @@ export function activate(context: ExtensionContext) {
});
});
}
}
function
initFoldingProvider
():
Disposable
{
function
getKind
(
kind
:
string
|
undefined
):
FoldingRangeKind
|
undefined
{
if
(
kind
)
{
switch
(
kind
)
{
case
LSFoldingRangeKind
.
Comment
:
return
FoldingRangeKind
.
Comment
;
case
LSFoldingRangeKind
.
Imports
:
return
FoldingRangeKind
.
Imports
;
case
LSFoldingRangeKind
.
Region
:
return
FoldingRangeKind
.
Region
;
}
}
return
void
0
;
}
return
languages
.
registerFoldingRangeProvider
(
documentSelector
,
{
provideFoldingRanges
(
document
:
TextDocument
,
context
:
FoldingContext
,
token
:
CancellationToken
)
{
const
param
:
FoldingRangeRequestParam
=
{
textDocument
:
client
.
code2ProtocolConverter
.
asTextDocumentIdentifier
(
document
)
};
return
client
.
sendRequest
(
FoldingRangeRequest
.
type
,
param
,
token
).
then
(
ranges
=>
{
if
(
Array
.
isArray
(
ranges
))
{
return
ranges
.
map
(
r
=>
new
FoldingRange
(
r
.
startLine
,
r
.
endLine
,
getKind
(
r
.
kind
)));
}
return
null
;
},
error
=>
{
client
.
logFailedRequest
(
FoldingRangeRequest
.
type
,
error
);
return
null
;
});
}
});
}
commands
.
registerCommand
(
'
_css.applyCodeAction
'
,
applyCodeAction
);
commands
.
registerCommand
(
'
_css.applyCodeAction
'
,
applyCodeAction
);
function
applyCodeAction
(
uri
:
string
,
documentVersion
:
number
,
edits
:
TextEdit
[])
{
function
applyCodeAction
(
uri
:
string
,
documentVersion
:
number
,
edits
:
TextEdit
[])
{
...
...
extensions/css-language-features/package.json
浏览文件 @
116948ef
...
@@ -707,8 +707,7 @@
...
@@ -707,8 +707,7 @@
]
]
},
},
"dependencies"
:
{
"dependencies"
:
{
"vscode-languageclient"
:
"^4.1.4"
,
"vscode-languageclient"
:
"^4.4.0"
,
"vscode-languageserver-protocol-foldingprovider"
:
"^2.0.1"
,
"vscode-nls"
:
"^3.2.4"
"vscode-nls"
:
"^3.2.4"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
extensions/css-language-features/server/package.json
浏览文件 @
116948ef
...
@@ -8,9 +8,8 @@
...
@@ -8,9 +8,8 @@
"node"
:
"*"
"node"
:
"*"
},
},
"dependencies"
:
{
"dependencies"
:
{
"vscode-css-languageservice"
:
"^3.0.9-next.20"
,
"vscode-css-languageservice"
:
"^3.0.9"
,
"vscode-languageserver"
:
"^4.1.3"
,
"vscode-languageserver"
:
"^4.4.0"
"vscode-languageserver-protocol-foldingprovider"
:
"^2.0.1"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/mocha"
:
"2.2.33"
,
"@types/mocha"
:
"2.2.33"
,
...
...
extensions/css-language-features/server/src/cssServerMain.ts
浏览文件 @
116948ef
...
@@ -15,7 +15,6 @@ import { getLanguageModelCache } from './languageModelCache';
...
@@ -15,7 +15,6 @@ import { getLanguageModelCache } from './languageModelCache';
import
{
formatError
,
runSafe
}
from
'
./utils/runner
'
;
import
{
formatError
,
runSafe
}
from
'
./utils/runner
'
;
import
URI
from
'
vscode-uri
'
;
import
URI
from
'
vscode-uri
'
;
import
{
getPathCompletionParticipant
}
from
'
./pathCompletion
'
;
import
{
getPathCompletionParticipant
}
from
'
./pathCompletion
'
;
import
{
FoldingRangeServerCapabilities
,
FoldingRangeRequest
}
from
'
vscode-languageserver-protocol-foldingprovider
'
;
export
interface
Settings
{
export
interface
Settings
{
css
:
LanguageSettings
;
css
:
LanguageSettings
;
...
@@ -78,7 +77,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
...
@@ -78,7 +77,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
scopedSettingsSupport
=
!!
getClientCapability
(
'
workspace.configuration
'
,
false
);
scopedSettingsSupport
=
!!
getClientCapability
(
'
workspace.configuration
'
,
false
);
foldingRangeLimit
=
getClientCapability
(
'
textDocument.foldingRange.rangeLimit
'
,
Number
.
MAX_VALUE
);
foldingRangeLimit
=
getClientCapability
(
'
textDocument.foldingRange.rangeLimit
'
,
Number
.
MAX_VALUE
);
const
capabilities
:
ServerCapabilities
&
FoldingRangeServerCapabilities
=
{
const
capabilities
:
ServerCapabilities
=
{
// Tell the client that the server works in FULL text document sync mode
// Tell the client that the server works in FULL text document sync mode
textDocumentSync
:
documents
.
syncKind
,
textDocumentSync
:
documents
.
syncKind
,
completionProvider
:
snippetSupport
?
{
resolveProvider
:
false
,
triggerCharacters
:
[
'
/
'
]
}
:
undefined
,
completionProvider
:
snippetSupport
?
{
resolveProvider
:
false
,
triggerCharacters
:
[
'
/
'
]
}
:
undefined
,
...
@@ -306,7 +305,7 @@ connection.onRenameRequest((renameParameters, token) => {
...
@@ -306,7 +305,7 @@ connection.onRenameRequest((renameParameters, token) => {
},
null
,
`Error while computing renames for
${
renameParameters
.
textDocument
.
uri
}
`
,
token
);
},
null
,
`Error while computing renames for
${
renameParameters
.
textDocument
.
uri
}
`
,
token
);
});
});
connection
.
on
Request
(
FoldingRangeRequest
.
type
,
(
params
,
token
)
=>
{
connection
.
on
FoldingRanges
(
(
params
,
token
)
=>
{
return
runSafe
(()
=>
{
return
runSafe
(()
=>
{
const
document
=
documents
.
get
(
params
.
textDocument
.
uri
);
const
document
=
documents
.
get
(
params
.
textDocument
.
uri
);
if
(
document
)
{
if
(
document
)
{
...
...
extensions/css-language-features/server/yarn.lock
浏览文件 @
116948ef
...
@@ -194,49 +194,42 @@ supports-color@5.4.0:
...
@@ -194,49 +194,42 @@ supports-color@5.4.0:
dependencies:
dependencies:
has-flag "^3.0.0"
has-flag "^3.0.0"
vscode-css-languageservice@^3.0.9
-next.20
:
vscode-css-languageservice@^3.0.9:
version "3.0.9
-next.20
"
version "3.0.9"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9
-next.20.tgz#8229aee66aa877929af5d2fd81a21731b415c92
e"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9
.tgz#770471350120c5bcf6918632a125638fc0ece3b
e"
dependencies:
dependencies:
vscode-languageserver-types "^3.
7.2
"
vscode-languageserver-types "^3.
10.0
"
vscode-nls "^3.2.
2
"
vscode-nls "^3.2.
4
"
vscode-jsonrpc@^3.6.2:
vscode-jsonrpc@^3.6.2:
version "3.6.2"
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
vscode-languageserver-protocol@^3.10.0:
version "2.0.1"
version "3.10.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.10.0.tgz#f8dcdf987687f64a26e7c32d498fc781a0e886dc"
dependencies:
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
dependencies:
vscode-jsonrpc "^3.6.2"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.
7.2
"
vscode-languageserver-types "^3.
10.0
"
vscode-languageserver-types@^3.
7.2
:
vscode-languageserver-types@^3.
10.0
:
version "3.
7.2
"
version "3.
10.0
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.
7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.
10.0.tgz#944e5308f3b36a3f372c766f1a344e903ec9c389
"
vscode-languageserver@^4.
1.3
:
vscode-languageserver@^4.
4.0
:
version "4.
1.3
"
version "4.
4.0
"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.
1.3.tgz#937d37c955b6b9c2409388413cd6f54d1eb9fe7d
"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.
4.0.tgz#b6e8b37a739ccb629d92f3635f0099d191c856fa
"
dependencies:
dependencies:
vscode-languageserver-protocol "^3.
7.2
"
vscode-languageserver-protocol "^3.
10.0
"
vscode-uri "^1.0.
1
"
vscode-uri "^1.0.
3
"
vscode-nls@^3.2.
2
:
vscode-nls@^3.2.
4
:
version "3.2.
2
"
version "3.2.
4
"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.
2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350
"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.
4.tgz#2166b4183c8aea884d20727f5449e62be69fd398
"
vscode-uri@^1.0.
1
:
vscode-uri@^1.0.
3
:
version "1.0.
1
"
version "1.0.
5
"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-1.0.
1.tgz#11a86befeac3c4aa3ec08623651a3c81a6d0bbc8
"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-1.0.
5.tgz#3b899a8ef71c37f3054d79bdbdda31c7bf36f20d
"
wrappy@1:
wrappy@1:
version "1.0.2"
version "1.0.2"
...
...
extensions/css-language-features/yarn.lock
浏览文件 @
116948ef
...
@@ -137,29 +137,22 @@ vscode-jsonrpc@^3.6.2:
...
@@ -137,29 +137,22 @@ vscode-jsonrpc@^3.6.2:
version "3.6.2"
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageclient@^4.
1.4
:
vscode-languageclient@^4.
4.0
:
version "4.
1.4
"
version "4.
4.0
"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.
1.4.tgz#fff1a6bca4714835dca7fce35bc4ce81442fdf2c
"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.
4.0.tgz#b05868f6477b6f0c9910b24daae4f3e8c4b65902
"
dependencies:
dependencies:
vscode-languageserver-protocol "^3.
7.2
"
vscode-languageserver-protocol "^3.
10.0
"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
vscode-languageserver-protocol@^3.10.0:
version "2.0.1"
version "3.10.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.10.0.tgz#f8dcdf987687f64a26e7c32d498fc781a0e886dc"
dependencies:
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
dependencies:
vscode-jsonrpc "^3.6.2"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.
7.2
"
vscode-languageserver-types "^3.
10.0
"
vscode-languageserver-types@^3.
7.2
:
vscode-languageserver-types@^3.
10.0
:
version "3.
7.2
"
version "3.
10.0
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.
7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb
"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.
10.0.tgz#944e5308f3b36a3f372c766f1a344e903ec9c389
"
vscode-nls@^3.2.4:
vscode-nls@^3.2.4:
version "3.2.4"
version "3.2.4"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录