Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
eb7ea2c4
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
eb7ea2c4
编写于
12月 13, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[html] use languageModes for language types
上级
f07fae16
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
58 addition
and
69 deletion
+58
-69
extensions/html-language-features/server/src/htmlServerMain.ts
...sions/html-language-features/server/src/htmlServerMain.ts
+6
-4
extensions/html-language-features/server/src/languageModelCache.ts
...s/html-language-features/server/src/languageModelCache.ts
+11
-11
extensions/html-language-features/server/src/modes/cssMode.ts
...nsions/html-language-features/server/src/modes/cssMode.ts
+2
-4
extensions/html-language-features/server/src/modes/embeddedSupport.ts
...tml-language-features/server/src/modes/embeddedSupport.ts
+1
-1
extensions/html-language-features/server/src/modes/formatting.ts
...ons/html-language-features/server/src/modes/formatting.ts
+1
-2
extensions/html-language-features/server/src/modes/htmlFolding.ts
...ns/html-language-features/server/src/modes/htmlFolding.ts
+2
-3
extensions/html-language-features/server/src/modes/htmlMode.ts
...sions/html-language-features/server/src/modes/htmlMode.ts
+3
-3
extensions/html-language-features/server/src/modes/pathCompletion.ts
...html-language-features/server/src/modes/pathCompletion.ts
+1
-2
extensions/html-language-features/server/src/modes/selectionRanges.ts
...tml-language-features/server/src/modes/selectionRanges.ts
+1
-2
extensions/html-language-features/server/src/test/completions.test.ts
...tml-language-features/server/src/test/completions.test.ts
+1
-4
extensions/html-language-features/server/src/test/embedded.test.ts
...s/html-language-features/server/src/test/embedded.test.ts
+11
-10
extensions/html-language-features/server/src/test/folding.test.ts
...ns/html-language-features/server/src/test/folding.test.ts
+13
-13
extensions/html-language-features/server/src/test/formatting.test.ts
...html-language-features/server/src/test/formatting.test.ts
+3
-4
extensions/html-language-features/server/src/test/selectionRanges.test.ts
...language-features/server/src/test/selectionRanges.test.ts
+1
-4
extensions/html-language-features/server/src/utils/documentContext.ts
...tml-language-features/server/src/utils/documentContext.ts
+1
-2
未找到文件。
extensions/html-language-features/server/src/htmlServerMain.ts
浏览文件 @
eb7ea2c4
...
...
@@ -6,11 +6,13 @@
import
{
createConnection
,
IConnection
,
TextDocuments
,
InitializeParams
,
InitializeResult
,
RequestType
,
DocumentRangeFormattingRequest
,
Disposable
,
DocumentSelector
,
TextDocumentPositionParams
,
ServerCapabilities
,
Position
,
ConfigurationRequest
,
ConfigurationParams
,
DidChangeWorkspaceFoldersNotification
,
Range
,
WorkspaceFolder
,
DocumentColorRequest
,
ColorInformation
,
ColorPresentationRequest
,
TextDocumentSyncKind
ConfigurationRequest
,
ConfigurationParams
,
DidChangeWorkspaceFoldersNotification
,
DocumentColorRequest
,
ColorPresentationRequest
,
TextDocumentSyncKind
}
from
'
vscode-languageserver
'
;
import
{
TextDocument
,
Diagnostic
,
DocumentLink
,
SymbolInformation
,
TextDocumentIdentifier
}
from
'
vscode-html-languageservice
'
;
import
{
getLanguageModes
,
LanguageModes
,
Settings
}
from
'
./modes/languageModes
'
;
import
{
getLanguageModes
,
LanguageModes
,
Settings
,
TextDocument
,
Position
,
Diagnostic
,
WorkspaceFolder
,
ColorInformation
,
Range
,
DocumentLink
,
SymbolInformation
,
TextDocumentIdentifier
}
from
'
./modes/languageModes
'
;
import
{
format
}
from
'
./modes/formatting
'
;
import
{
pushAll
}
from
'
./utils/arrays
'
;
...
...
extensions/html-language-features/server/src/languageModelCache.ts
浏览文件 @
eb7ea2c4
...
...
@@ -18,10 +18,10 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
let
cleanupInterval
:
NodeJS
.
Timer
|
undefined
=
undefined
;
if
(
cleanupIntervalTimeInSec
>
0
)
{
cleanupInterval
=
setInterval
(()
=>
{
le
t
cutoffTime
=
Date
.
now
()
-
cleanupIntervalTimeInSec
*
1000
;
le
t
uris
=
Object
.
keys
(
languageModels
);
for
(
le
t
uri
of
uris
)
{
le
t
languageModelInfo
=
languageModels
[
uri
];
cons
t
cutoffTime
=
Date
.
now
()
-
cleanupIntervalTimeInSec
*
1000
;
cons
t
uris
=
Object
.
keys
(
languageModels
);
for
(
cons
t
uri
of
uris
)
{
cons
t
languageModelInfo
=
languageModels
[
uri
];
if
(
languageModelInfo
.
cTime
<
cutoffTime
)
{
delete
languageModels
[
uri
];
nModels
--
;
...
...
@@ -32,14 +32,14 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
return
{
get
(
document
:
TextDocument
):
T
{
le
t
version
=
document
.
version
;
le
t
languageId
=
document
.
languageId
;
le
t
languageModelInfo
=
languageModels
[
document
.
uri
];
cons
t
version
=
document
.
version
;
cons
t
languageId
=
document
.
languageId
;
cons
t
languageModelInfo
=
languageModels
[
document
.
uri
];
if
(
languageModelInfo
&&
languageModelInfo
.
version
===
version
&&
languageModelInfo
.
languageId
===
languageId
)
{
languageModelInfo
.
cTime
=
Date
.
now
();
return
languageModelInfo
.
languageModel
;
}
le
t
languageModel
=
parse
(
document
);
cons
t
languageModel
=
parse
(
document
);
languageModels
[
document
.
uri
]
=
{
languageModel
,
version
,
languageId
,
cTime
:
Date
.
now
()
};
if
(
!
languageModelInfo
)
{
nModels
++
;
...
...
@@ -48,8 +48,8 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
if
(
nModels
===
maxEntries
)
{
let
oldestTime
=
Number
.
MAX_VALUE
;
let
oldestUri
=
null
;
for
(
le
t
uri
in
languageModels
)
{
le
t
languageModelInfo
=
languageModels
[
uri
];
for
(
cons
t
uri
in
languageModels
)
{
cons
t
languageModelInfo
=
languageModels
[
uri
];
if
(
languageModelInfo
.
cTime
<
oldestTime
)
{
oldestUri
=
uri
;
oldestTime
=
languageModelInfo
.
cTime
;
...
...
@@ -64,7 +64,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
},
onDocumentRemoved
(
document
:
TextDocument
)
{
le
t
uri
=
document
.
uri
;
cons
t
uri
=
document
.
uri
;
if
(
languageModels
[
uri
])
{
delete
languageModels
[
uri
];
nModels
--
;
...
...
extensions/html-language-features/server/src/modes/cssMode.ts
浏览文件 @
eb7ea2c4
...
...
@@ -4,11 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import
{
LanguageModelCache
,
getLanguageModelCache
}
from
'
../languageModelCache
'
;
import
{
TextDocument
,
Position
,
Range
,
CompletionList
}
from
'
vscode-html-languageservice
'
;
import
{
Stylesheet
,
FoldingRange
,
LanguageService
as
CSSLanguageService
}
from
'
vscode-css-languageservice
'
;
import
{
LanguageMode
,
Workspace
}
from
'
./languageModes
'
;
import
{
Stylesheet
,
LanguageService
as
CSSLanguageService
}
from
'
vscode-css-languageservice
'
;
import
{
FoldingRange
,
LanguageMode
,
Workspace
,
Color
,
TextDocument
,
Position
,
Range
,
CompletionList
}
from
'
./languageModes
'
;
import
{
HTMLDocumentRegions
,
CSS_STYLE_RULE
}
from
'
./embeddedSupport
'
;
import
{
Color
}
from
'
vscode-languageserver
'
;
export
function
getCSSMode
(
cssLanguageService
:
CSSLanguageService
,
documentRegions
:
LanguageModelCache
<
HTMLDocumentRegions
>
,
workspace
:
Workspace
):
LanguageMode
{
let
embeddedCSSDocuments
=
getLanguageModelCache
<
TextDocument
>
(
10
,
60
,
document
=>
documentRegions
.
get
(
document
).
getEmbeddedDocument
(
'
css
'
));
...
...
extensions/html-language-features/server/src/modes/embeddedSupport.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TextDocument
,
Position
,
LanguageService
,
TokenType
,
Range
}
from
'
vscode-html-languageservice
'
;
import
{
TextDocument
,
Position
,
LanguageService
,
TokenType
,
Range
}
from
'
./languageModes
'
;
export
interface
LanguageRange
extends
Range
{
languageId
:
string
|
undefined
;
...
...
extensions/html-language-features/server/src/modes/formatting.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,8 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TextDocument
,
Range
,
TextEdit
,
FormattingOptions
,
Position
}
from
'
vscode-html-languageservice
'
;
import
{
LanguageModes
,
Settings
,
LanguageModeRange
}
from
'
./languageModes
'
;
import
{
LanguageModes
,
Settings
,
LanguageModeRange
,
TextDocument
,
Range
,
TextEdit
,
FormattingOptions
,
Position
}
from
'
./languageModes
'
;
import
{
pushAll
}
from
'
../utils/arrays
'
;
import
{
isEOL
}
from
'
../utils/strings
'
;
...
...
extensions/html-language-features/server/src/modes/htmlFolding.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,9 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TextDocument
,
CancellationToken
,
Position
,
Range
}
from
'
vscode-languageserver
'
;
import
{
FoldingRange
}
from
'
vscode-html-languageservice
'
;
import
{
LanguageModes
,
LanguageMode
}
from
'
./languageModes
'
;
import
{
TextDocument
,
FoldingRange
,
Position
,
Range
,
LanguageModes
,
LanguageMode
}
from
'
./languageModes
'
;
import
{
CancellationToken
}
from
'
vscode-languageserver
'
;
export
function
getFoldingRanges
(
languageModes
:
LanguageModes
,
document
:
TextDocument
,
maxRanges
:
number
|
undefined
,
_cancellationToken
:
CancellationToken
|
null
):
FoldingRange
[]
{
let
htmlMode
=
languageModes
.
getMode
(
'
html
'
);
...
...
extensions/html-language-features/server/src/modes/htmlMode.ts
浏览文件 @
eb7ea2c4
...
...
@@ -7,9 +7,9 @@ import { getLanguageModelCache } from '../languageModelCache';
import
{
LanguageService
as
HTMLLanguageService
,
HTMLDocument
,
DocumentContext
,
FormattingOptions
,
HTMLFormatConfiguration
,
SelectionRange
,
TextDocument
,
Position
,
Range
,
CompletionItem
,
FoldingRange
}
from
'
vscode-html-languageservice
'
;
import
{
LanguageMode
,
Workspace
}
from
'
./languageModes
'
;
TextDocument
,
Position
,
Range
,
CompletionItem
,
FoldingRange
,
LanguageMode
,
Workspace
}
from
'
./languageModes
'
;
import
{
getPathCompletionParticipant
}
from
'
./pathCompletion
'
;
export
function
getHTMLMode
(
htmlLanguageService
:
HTMLLanguageService
,
workspace
:
Workspace
):
LanguageMode
{
...
...
extensions/html-language-features/server/src/modes/pathCompletion.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,11 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
WorkspaceFolder
}
from
'
vscode-languageserver
'
;
import
*
as
path
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
import
{
URI
}
from
'
vscode-uri
'
;
import
{
ICompletionParticipant
,
TextDocument
,
CompletionItemKind
,
CompletionItem
,
TextEdit
,
Range
,
Position
}
from
'
vscode-html-languageservice
'
;
import
{
ICompletionParticipant
,
TextDocument
,
CompletionItemKind
,
CompletionItem
,
TextEdit
,
Range
,
Position
,
WorkspaceFolder
}
from
'
./languageModes
'
;
import
{
startsWith
}
from
'
../utils/strings
'
;
import
{
contains
}
from
'
../utils/arrays
'
;
...
...
extensions/html-language-features/server/src/modes/selectionRanges.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,8 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
LanguageModes
}
from
'
./languageModes
'
;
import
{
TextDocument
,
Position
,
Range
,
SelectionRange
}
from
'
vscode-html-languageservice
'
;
import
{
LanguageModes
,
TextDocument
,
Position
,
Range
,
SelectionRange
}
from
'
./languageModes
'
;
export
function
getSelectionRanges
(
languageModes
:
LanguageModes
,
document
:
TextDocument
,
positions
:
Position
[])
{
const
htmlMode
=
languageModes
.
getMode
(
'
html
'
);
...
...
extensions/html-language-features/server/src/test/completions.test.ts
浏览文件 @
eb7ea2c4
...
...
@@ -6,10 +6,7 @@ import 'mocha';
import
*
as
assert
from
'
assert
'
;
import
*
as
path
from
'
path
'
;
import
{
URI
}
from
'
vscode-uri
'
;
import
{
getLanguageModes
}
from
'
../modes/languageModes
'
;
import
{
WorkspaceFolder
}
from
'
vscode-languageserver
'
;
import
{
TextDocument
,
CompletionList
,
CompletionItemKind
,
ClientCapabilities
}
from
'
vscode-html-languageservice
'
;
import
{
getLanguageModes
,
WorkspaceFolder
,
TextDocument
,
CompletionList
,
CompletionItemKind
,
ClientCapabilities
}
from
'
../modes/languageModes
'
;
export
interface
ItemDescription
{
label
:
string
;
documentation
?:
string
;
...
...
extensions/html-language-features/server/src/test/embedded.test.ts
浏览文件 @
eb7ea2c4
...
...
@@ -5,31 +5,32 @@
import
'
mocha
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
embeddedSupport
from
'
../modes/embeddedSupport
'
;
import
{
getLanguageService
,
TextDocument
}
from
'
vscode-html-languageservice
'
;
import
{
getLanguageService
}
from
'
vscode-html-languageservice
'
;
import
{
TextDocument
}
from
'
../modes/languageModes
'
;
suite
(
'
HTML Embedded Support
'
,
()
=>
{
var
htmlLanguageService
=
getLanguageService
();
const
htmlLanguageService
=
getLanguageService
();
function
assertLanguageId
(
value
:
string
,
expectedLanguageId
:
string
|
undefined
):
void
{
le
t
offset
=
value
.
indexOf
(
'
|
'
);
cons
t
offset
=
value
.
indexOf
(
'
|
'
);
value
=
value
.
substr
(
0
,
offset
)
+
value
.
substr
(
offset
+
1
);
le
t
document
=
TextDocument
.
create
(
'
test://test/test.html
'
,
'
html
'
,
0
,
value
);
cons
t
document
=
TextDocument
.
create
(
'
test://test/test.html
'
,
'
html
'
,
0
,
value
);
le
t
position
=
document
.
positionAt
(
offset
);
cons
t
position
=
document
.
positionAt
(
offset
);
le
t
docRegions
=
embeddedSupport
.
getDocumentRegions
(
htmlLanguageService
,
document
);
le
t
languageId
=
docRegions
.
getLanguageAtPosition
(
position
);
cons
t
docRegions
=
embeddedSupport
.
getDocumentRegions
(
htmlLanguageService
,
document
);
cons
t
languageId
=
docRegions
.
getLanguageAtPosition
(
position
);
assert
.
equal
(
languageId
,
expectedLanguageId
);
}
function
assertEmbeddedLanguageContent
(
value
:
string
,
languageId
:
string
,
expectedContent
:
string
):
void
{
le
t
document
=
TextDocument
.
create
(
'
test://test/test.html
'
,
'
html
'
,
0
,
value
);
cons
t
document
=
TextDocument
.
create
(
'
test://test/test.html
'
,
'
html
'
,
0
,
value
);
le
t
docRegions
=
embeddedSupport
.
getDocumentRegions
(
htmlLanguageService
,
document
);
le
t
content
=
docRegions
.
getEmbeddedDocument
(
languageId
);
cons
t
docRegions
=
embeddedSupport
.
getDocumentRegions
(
htmlLanguageService
,
document
);
cons
t
content
=
docRegions
.
getEmbeddedDocument
(
languageId
);
assert
.
equal
(
content
.
getText
(),
expectedContent
);
}
...
...
extensions/html-language-features/server/src/test/folding.test.ts
浏览文件 @
eb7ea2c4
...
...
@@ -17,13 +17,13 @@ interface ExpectedIndentRange {
}
function
assertRanges
(
lines
:
string
[],
expected
:
ExpectedIndentRange
[],
message
?:
string
,
nRanges
?:
number
):
void
{
le
t
document
=
TextDocument
.
create
(
'
test://foo/bar.json
'
,
'
json
'
,
1
,
lines
.
join
(
'
\n
'
));
le
t
workspace
=
{
cons
t
document
=
TextDocument
.
create
(
'
test://foo/bar.json
'
,
'
json
'
,
1
,
lines
.
join
(
'
\n
'
));
cons
t
workspace
=
{
settings
:
{},
folders
:
[{
name
:
'
foo
'
,
uri
:
'
test://foo
'
}]
};
le
t
languageModes
=
getLanguageModes
({
css
:
true
,
javascript
:
true
},
workspace
,
ClientCapabilities
.
LATEST
);
le
t
actual
=
getFoldingRanges
(
languageModes
,
document
,
nRanges
,
null
);
cons
t
languageModes
=
getLanguageModes
({
css
:
true
,
javascript
:
true
},
workspace
,
ClientCapabilities
.
LATEST
);
cons
t
actual
=
getFoldingRanges
(
languageModes
,
document
,
nRanges
,
null
);
let
actualRanges
=
[];
for
(
let
i
=
0
;
i
<
actual
.
length
;
i
++
)
{
...
...
@@ -40,7 +40,7 @@ function r(startLine: number, endLine: number, kind?: string): ExpectedIndentRan
suite
(
'
HTML Folding
'
,
()
=>
{
test
(
'
Embedded JavaScript
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/*0*/
'
<html>
'
,
/*1*/
'
<head>
'
,
/*2*/
'
<script>
'
,
...
...
@@ -54,7 +54,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded JavaScript - multiple areas
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head>
'
,
/* 2*/
'
<script>
'
,
...
...
@@ -75,7 +75,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded JavaScript - incomplete
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head>
'
,
/* 2*/
'
<script>
'
,
...
...
@@ -91,7 +91,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded JavaScript - regions
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head>
'
,
/* 2*/
'
<script>
'
,
...
...
@@ -108,7 +108,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded CSS
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head>
'
,
/* 2*/
'
<style>
'
,
...
...
@@ -124,7 +124,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded CSS - multiple areas
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head style="color:red">
'
,
/* 2*/
'
<style>
'
,
...
...
@@ -145,7 +145,7 @@ suite('HTML Folding', () => {
});
test
(
'
Embedded CSS - regions
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<html>
'
,
/* 1*/
'
<head>
'
,
/* 2*/
'
<style>
'
,
...
...
@@ -163,7 +163,7 @@ suite('HTML Folding', () => {
// test('Embedded JavaScript - multi line comment', () => {
//
le
t input = [
//
cons
t input = [
// /* 0*/'<html>',
// /* 1*/'<head>',
// /* 2*/'<script>',
...
...
@@ -178,7 +178,7 @@ suite('HTML Folding', () => {
// });
test
(
'
Test limit
'
,
()
=>
{
le
t
input
=
[
cons
t
input
=
[
/* 0*/
'
<div>
'
,
/* 1*/
'
<span>
'
,
/* 2*/
'
<b>
'
,
...
...
extensions/html-language-features/server/src/test/formatting.test.ts
浏览文件 @
eb7ea2c4
...
...
@@ -7,8 +7,7 @@ import * as path from 'path';
import
*
as
fs
from
'
fs
'
;
import
*
as
assert
from
'
assert
'
;
import
{
getLanguageModes
}
from
'
../modes/languageModes
'
;
import
{
TextDocument
,
Range
,
FormattingOptions
,
ClientCapabilities
}
from
'
vscode-html-languageservice
'
;
import
{
getLanguageModes
,
TextDocument
,
Range
,
FormattingOptions
,
ClientCapabilities
}
from
'
../modes/languageModes
'
;
import
{
format
}
from
'
../modes/formatting
'
;
...
...
@@ -168,7 +167,7 @@ suite('HTML Embedded Formatting', () => {
}
};
var
content
=
[
const
content
=
[
'
<html>
'
,
''
,
'
<body>
'
,
...
...
@@ -179,7 +178,7 @@ suite('HTML Embedded Formatting', () => {
'
</html>
'
,
].
join
(
'
\n
'
);
var
expected
=
[
const
expected
=
[
'
<html>
'
,
''
,
'
<body>
'
,
...
...
extensions/html-language-features/server/src/test/selectionRanges.test.ts
浏览文件 @
eb7ea2c4
...
...
@@ -5,10 +5,7 @@
import
'
mocha
'
;
import
*
as
assert
from
'
assert
'
;
import
{
SelectionRange
}
from
'
vscode-languageserver-types
'
;
import
{
TextDocument
}
from
'
vscode-languageserver-textdocument
'
;
import
{
getLanguageModes
}
from
'
../modes/languageModes
'
;
import
{
ClientCapabilities
}
from
'
vscode-html-languageservice
'
;
import
{
getLanguageModes
,
ClientCapabilities
,
TextDocument
,
SelectionRange
}
from
'
../modes/languageModes
'
;
import
{
getSelectionRanges
}
from
'
../modes/selectionRanges
'
;
function
assertRanges
(
content
:
string
,
expected
:
(
number
|
string
)[][]):
void
{
...
...
extensions/html-language-features/server/src/utils/documentContext.ts
浏览文件 @
eb7ea2c4
...
...
@@ -3,10 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
DocumentContext
}
from
'
vscode-html-languageservice
'
;
import
{
DocumentContext
,
WorkspaceFolder
}
from
'
../modes/languageModes
'
;
import
{
endsWith
,
startsWith
}
from
'
../utils/strings
'
;
import
*
as
url
from
'
url
'
;
import
{
WorkspaceFolder
}
from
'
vscode-languageserver
'
;
export
function
getDocumentContext
(
documentUri
:
string
,
workspaceFolders
:
WorkspaceFolder
[]):
DocumentContext
{
function
getRootFolder
():
string
|
undefined
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录