Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
4839f942
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4839f942
编写于
11月 24, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[css] adopt snippettext API and update to TS2.0
上级
99864f9c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
55 addition
and
177 deletion
+55
-177
extensions/css/client/src/cssMain.ts
extensions/css/client/src/cssMain.ts
+18
-18
extensions/css/client/src/typings/ref.d.ts
extensions/css/client/src/typings/ref.d.ts
+1
-6
extensions/css/client/tsconfig.json
extensions/css/client/tsconfig.json
+4
-2
extensions/css/npm-shrinkwrap.json
extensions/css/npm-shrinkwrap.json
+8
-8
extensions/css/package.json
extensions/css/package.json
+4
-1
extensions/css/server/npm-shrinkwrap.json
extensions/css/server/npm-shrinkwrap.json
+10
-17
extensions/css/server/package.json
extensions/css/server/package.json
+5
-2
extensions/css/server/src/cssServerMain.ts
extensions/css/server/src/cssServerMain.ts
+1
-1
extensions/css/server/src/typings/promise.d.ts
extensions/css/server/src/typings/promise.d.ts
+0
-112
extensions/css/server/src/typings/ref.d.ts
extensions/css/server/src/typings/ref.d.ts
+0
-8
extensions/css/server/tsconfig.json
extensions/css/server/tsconfig.json
+4
-2
未找到文件。
extensions/css/client/src/cssMain.ts
浏览文件 @
4839f942
...
...
@@ -7,14 +7,14 @@
import
*
as
path
from
'
path
'
;
import
{
languages
,
window
,
commands
,
ExtensionContext
}
from
'
vscode
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
RequestType
,
Range
,
TextEdit
,
Protocol2Code
}
from
'
vscode-languageclient
'
;
import
{
LanguageClient
,
LanguageClientOptions
,
ServerOptions
,
TransportKind
,
RequestType
,
Range
,
TextEdit
}
from
'
vscode-languageclient
'
;
import
{
activateColorDecorations
}
from
'
./colorDecorators
'
;
import
*
as
nls
from
'
vscode-nls
'
;
let
localize
=
nls
.
loadMessageBundle
();
namespace
ColorSymbolRequest
{
export
const
type
:
RequestType
<
string
,
Range
[],
any
>
=
{
get
method
()
{
return
'
css/colorSymbols
'
;
}
};
export
const
type
:
RequestType
<
string
,
Range
[],
any
,
any
>
=
{
get
method
()
{
return
'
css/colorSymbols
'
;
},
_
:
null
};
}
// this method is called when vs code is activated
...
...
@@ -51,7 +51,7 @@ export function activate(context: ExtensionContext) {
context
.
subscriptions
.
push
(
disposable
);
let
colorRequestor
=
(
uri
:
string
)
=>
{
return
client
.
sendRequest
(
ColorSymbolRequest
.
type
,
uri
).
then
(
ranges
=>
ranges
.
map
(
Protocol2Code
.
asRange
));
return
client
.
sendRequest
(
ColorSymbolRequest
.
type
,
uri
).
then
(
ranges
=>
ranges
.
map
(
client
.
protocol2CodeConverter
.
asRange
));
};
disposable
=
activateColorDecorations
(
colorRequestor
,
{
css
:
true
,
scss
:
true
,
less
:
true
});
context
.
subscriptions
.
push
(
disposable
);
...
...
@@ -69,23 +69,23 @@ export function activate(context: ExtensionContext) {
});
commands
.
registerCommand
(
'
_css.applyCodeAction
'
,
applyCodeAction
);
}
function
applyCodeAction
(
uri
:
string
,
documentVersion
:
number
,
edits
:
TextEdit
[])
{
let
textEditor
=
window
.
activeTextEditor
;
if
(
textEditor
&&
textEditor
.
document
.
uri
.
toString
()
===
uri
)
{
if
(
textEditor
.
document
.
version
!==
documentVersion
)
{
window
.
showInformationMessage
(
`CSS fix is outdated and can't be applied to the document.`
);
}
textEditor
.
edit
(
mutator
=>
{
for
(
let
edit
of
edits
)
{
mutator
.
replace
(
Protocol2Code
.
asRange
(
edit
.
range
),
edit
.
newText
);
function
applyCodeAction
(
uri
:
string
,
documentVersion
:
number
,
edits
:
TextEdit
[])
{
let
textEditor
=
window
.
activeTextEditor
;
if
(
textEditor
&&
textEditor
.
document
.
uri
.
toString
()
===
uri
)
{
if
(
textEditor
.
document
.
version
!==
documentVersion
)
{
window
.
showInformationMessage
(
`CSS fix is outdated and can't be applied to the document.`
);
}
}).
then
(
success
=>
{
if
(
!
success
)
{
window
.
showErrorMessage
(
'
Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.
'
);
}
});
textEditor
.
edit
(
mutator
=>
{
for
(
let
edit
of
edits
)
{
mutator
.
replace
(
client
.
protocol2CodeConverter
.
asRange
(
edit
.
range
),
edit
.
newText
);
}
}).
then
(
success
=>
{
if
(
!
success
)
{
window
.
showErrorMessage
(
'
Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.
'
);
}
});
}
}
}
extensions/css/client/src/typings/ref.d.ts
浏览文件 @
4839f942
...
...
@@ -3,9 +3,4 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../../extensions/node.d.ts'/>
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../../extensions/declares.d.ts'/>
/// <reference path='../../../node_modules/vscode-languageclient/lib/main.d.ts'/>
\ No newline at end of file
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
\ No newline at end of file
extensions/css/client/tsconfig.json
浏览文件 @
4839f942
{
"compilerOptions"
:
{
"noLib"
:
true
,
"target"
:
"es5"
,
"module"
:
"commonjs"
,
"outDir"
:
"./out"
"outDir"
:
"./out"
,
"lib"
:
[
"es5"
,
"es2015.promise"
]
},
"exclude"
:
[
"node_modules"
...
...
extensions/css/npm-shrinkwrap.json
浏览文件 @
4839f942
...
...
@@ -3,19 +3,19 @@
"version"
:
"0.1.0"
,
"dependencies"
:
{
"vscode-jsonrpc"
:
{
"version"
:
"
2.3.2-next.5
"
,
"from"
:
"vscode-jsonrpc@>=
2.3.2-next.2 <3
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-
2.3.2-next.5
.tgz"
"version"
:
"
3.0.1-alpha.2
"
,
"from"
:
"vscode-jsonrpc@>=
3.0.1-alpha.2 <4
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-
3.0.1-alpha.2
.tgz"
},
"vscode-languageclient"
:
{
"version"
:
"
2.4.2-next.2
2"
,
"version"
:
"
3.0.1-alpha.
2"
,
"from"
:
"vscode-languageclient@next"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-
2.4.2-next.2
2.tgz"
"resolved"
:
"https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-
3.0.1-alpha.
2.tgz"
},
"vscode-languageserver-types"
:
{
"version"
:
"
1.0.3
"
,
"from"
:
"vscode-languageserver-types@>=
1.0.3 <2
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-
1.0.3
.tgz"
"version"
:
"
3.0.1-alpha.2
"
,
"from"
:
"vscode-languageserver-types@>=
3.0.1-alpha.2 <4
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-
3.0.1-alpha.2
.tgz"
},
"vscode-nls"
:
{
"version"
:
"1.0.7"
,
...
...
extensions/css/package.json
浏览文件 @
4839f942
...
...
@@ -646,7 +646,10 @@
}
},
"dependencies"
:
{
"vscode-languageclient"
:
"^
2.4.2-next.2
2"
,
"vscode-languageclient"
:
"^
3.0.1-alpha.
2"
,
"vscode-nls"
:
"^1.0.7"
},
"devDependencies"
:
{
"@types/node"
:
"^6.0.51"
}
}
extensions/css/server/npm-shrinkwrap.json
浏览文件 @
4839f942
...
...
@@ -3,31 +3,24 @@
"version"
:
"1.0.0"
,
"dependencies"
:
{
"vscode-css-languageservice"
:
{
"version"
:
"2.0.0-next.
4
"
,
"version"
:
"2.0.0-next.
5
"
,
"from"
:
"vscode-css-languageservice@next"
,
"resolved"
:
"https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.
4
.tgz"
"resolved"
:
"https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.
5
.tgz"
},
"vscode-jsonrpc"
:
{
"version"
:
"
2.3.2-next.5
"
,
"from"
:
"vscode-jsonrpc@>=
2.3.2-next.2 <3
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-
2.3.2-next.5
.tgz"
"version"
:
"
3.0.1-alpha.2
"
,
"from"
:
"vscode-jsonrpc@>=
3.0.1-alpha.2 <4
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-
3.0.1-alpha.2
.tgz"
},
"vscode-languageserver"
:
{
"version"
:
"
2.4.0-next.1
2"
,
"version"
:
"
3.0.1-alpha.
2"
,
"from"
:
"vscode-languageserver@next"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-2.4.0-next.12.tgz"
,
"dependencies"
:
{
"vscode-languageserver-types"
:
{
"version"
:
"1.0.3"
,
"from"
:
"vscode-languageserver-types@>=1.0.3 <2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
}
}
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.2.tgz"
},
"vscode-languageserver-types"
:
{
"version"
:
"
1.0.5-next.1
"
,
"from"
:
"vscode-languageserver-types@>=
1.0.5-next.1 <2
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-
1.0.5-next.1
.tgz"
"version"
:
"
3.0.1-alpha.2
"
,
"from"
:
"vscode-languageserver-types@>=
3.0.1-alpha.2 <4
.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-
3.0.1-alpha.2
.tgz"
},
"vscode-nls"
:
{
"version"
:
"1.0.7"
,
...
...
extensions/css/server/package.json
浏览文件 @
4839f942
...
...
@@ -8,8 +8,11 @@
"node"
:
"*"
},
"dependencies"
:
{
"vscode-css-languageservice"
:
"^2.0.0-next.4"
,
"vscode-languageserver"
:
"^2.4.0-next.12"
"vscode-css-languageservice"
:
"^2.0.0-next.5"
,
"vscode-languageserver"
:
"^3.0.1-alpha.2"
},
"devDependencies"
:
{
"@types/node"
:
"^6.0.51"
},
"scripts"
:
{
"compile"
:
"gulp compile-extension:css-server"
,
...
...
extensions/css/server/src/cssServerMain.ts
浏览文件 @
4839f942
...
...
@@ -13,7 +13,7 @@ import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService,
import
{
getLanguageModelCache
}
from
'
./languageModelCache
'
;
namespace
ColorSymbolRequest
{
export
const
type
:
RequestType
<
string
,
Range
[],
any
>
=
{
get
method
()
{
return
'
css/colorSymbols
'
;
}
};
export
const
type
:
RequestType
<
string
,
Range
[],
any
,
any
>
=
{
get
method
()
{
return
'
css/colorSymbols
'
;
},
_
:
null
};
}
export
interface
Settings
{
...
...
extensions/css/server/src/typings/promise.d.ts
已删除
100644 → 0
浏览文件 @
99864f9c
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
* lib.core.es6.d.ts file. See above Copyright notice.
*/
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise libary is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommand the use of native promises which are available in VS Code.
*/
interface
Thenable
<
T
>
{
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then
<
TResult
>
(
onfulfilled
?:
(
value
:
T
)
=>
TResult
|
Thenable
<
TResult
>
,
onrejected
?:
(
reason
:
any
)
=>
TResult
|
Thenable
<
TResult
>
):
Thenable
<
TResult
>
;
then
<
TResult
>
(
onfulfilled
?:
(
value
:
T
)
=>
TResult
|
Thenable
<
TResult
>
,
onrejected
?:
(
reason
:
any
)
=>
void
):
Thenable
<
TResult
>
;
}
/**
* Represents the completion of an asynchronous operation
*/
interface
Promise
<
T
>
extends
Thenable
<
T
>
{
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then
<
TResult
>
(
onfulfilled
?:
(
value
:
T
)
=>
TResult
|
Thenable
<
TResult
>
,
onrejected
?:
(
reason
:
any
)
=>
TResult
|
Thenable
<
TResult
>
):
Promise
<
TResult
>
;
then
<
TResult
>
(
onfulfilled
?:
(
value
:
T
)
=>
TResult
|
Thenable
<
TResult
>
,
onrejected
?:
(
reason
:
any
)
=>
void
):
Promise
<
TResult
>
;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch
(
onrejected
?:
(
reason
:
any
)
=>
T
|
Thenable
<
T
>
):
Promise
<
T
>
;
}
interface
PromiseConstructor
{
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new
<
T
>
(
executor
:
(
resolve
:
(
value
?:
T
|
Thenable
<
T
>
)
=>
void
,
reject
:
(
reason
?:
any
)
=>
void
)
=>
void
):
Promise
<
T
>
;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all
<
T
>
(
values
:
Array
<
T
|
Thenable
<
T
>>
):
Promise
<
T
[]
>
;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race
<
T
>
(
values
:
Array
<
T
|
Thenable
<
T
>>
):
Promise
<
T
>
;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject
(
reason
:
any
):
Promise
<
void
>
;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject
<
T
>
(
reason
:
any
):
Promise
<
T
>
;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve
<
T
>
(
value
:
T
|
Thenable
<
T
>
):
Promise
<
T
>
;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve
():
Promise
<
void
>
;
}
declare
var
Promise
:
PromiseConstructor
;
extensions/css/server/src/typings/ref.d.ts
已删除
100644 → 0
浏览文件 @
99864f9c
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../../extensions/node.d.ts'/>
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../../extensions/declares.d.ts'/>
\ No newline at end of file
extensions/css/server/tsconfig.json
浏览文件 @
4839f942
{
"compilerOptions"
:
{
"noLib"
:
true
,
"target"
:
"es5"
,
"module"
:
"commonjs"
,
"outDir"
:
"./out"
"outDir"
:
"./out"
,
"lib"
:
[
"es5"
]
},
"exclude"
:
[
"node_modules"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录