Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b2fe50a8
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,体验更适合开发者的 AI 搜索 >>
提交
b2fe50a8
编写于
10月 11, 2016
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt useOneInferredProject
上级
ad0668ac
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
2137 addition
and
5 deletion
+2137
-5
extensions/typescript/src/features/bufferSyncSupport.ts
extensions/typescript/src/features/bufferSyncSupport.ts
+15
-0
extensions/typescript/src/features/linkedMap.ts
extensions/typescript/src/features/linkedMap.ts
+153
-0
extensions/typescript/src/protocol.ts
extensions/typescript/src/protocol.ts
+1947
-0
extensions/typescript/src/typescriptService.ts
extensions/typescript/src/typescriptService.ts
+3
-0
extensions/typescript/src/typescriptServiceClient.ts
extensions/typescript/src/typescriptServiceClient.ts
+19
-5
未找到文件。
extensions/typescript/src/features/bufferSyncSupport.ts
浏览文件 @
b2fe50a8
...
...
@@ -11,6 +11,7 @@ import { workspace, TextDocument, TextDocumentChangeEvent, TextDocumentContentCh
import
*
as
Proto
from
'
../protocol
'
;
import
{
ITypescriptServiceClient
,
APIVersion
}
from
'
../typescriptService
'
;
import
{
Delayer
}
from
'
../utils/async
'
;
import
LinkedMap
from
'
./linkedMap
'
;
interface
IDiagnosticRequestor
{
requestDiagnostic
(
filepath
:
string
):
void
;
...
...
@@ -110,6 +111,7 @@ export default class BufferSyncSupport {
private
pendingDiagnostics
:
{
[
key
:
string
]:
number
;
};
private
diagnosticDelayer
:
Delayer
<
any
>
;
private
emitQueue
:
LinkedMap
<
string
>
;
constructor
(
client
:
ITypescriptServiceClient
,
modeIds
:
string
[],
diagnostics
:
Diagnostics
,
extensions
:
Map
<
boolean
>
,
validate
:
boolean
=
true
)
{
this
.
client
=
client
;
...
...
@@ -125,12 +127,14 @@ export default class BufferSyncSupport {
this
.
diagnosticDelayer
=
new
Delayer
<
any
>
(
300
);
this
.
syncedBuffers
=
Object
.
create
(
null
);
this
.
emitQueue
=
new
LinkedMap
<
string
>
();
}
public
listen
():
void
{
workspace
.
onDidOpenTextDocument
(
this
.
onDidOpenTextDocument
,
this
,
this
.
disposables
);
workspace
.
onDidCloseTextDocument
(
this
.
onDidCloseTextDocument
,
this
,
this
.
disposables
);
workspace
.
onDidChangeTextDocument
(
this
.
onDidChangeTextDocument
,
this
,
this
.
disposables
);
workspace
.
onDidSaveTextDocument
(
this
.
onDidSaveTextDocument
,
this
,
this
.
disposables
);
workspace
.
textDocuments
.
forEach
(
this
.
onDidOpenTextDocument
,
this
);
}
...
...
@@ -205,6 +209,17 @@ export default class BufferSyncSupport {
syncedBuffer
.
onContentChanged
(
e
.
contentChanges
);
}
private
onDidSaveTextDocument
(
document
:
TextDocument
):
void
{
let
filepath
:
string
=
this
.
client
.
asAbsolutePath
(
document
.
uri
);
if
(
!
filepath
)
{
return
;
}
let
syncedBuffer
=
this
.
syncedBuffers
[
filepath
];
if
(
!
syncedBuffer
)
{
return
;
}
}
public
requestAllDiagnostics
()
{
if
(
!
this
.
_validate
)
{
return
;
...
...
extensions/typescript/src/features/linkedMap.ts
0 → 100644
浏览文件 @
b2fe50a8
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
interface
Item
<
T
>
{
previous
:
Item
<
T
>
;
next
:
Item
<
T
>
;
key
:
string
;
value
:
T
;
}
export
default
class
LinkedMap
<
T
>
{
private
map
:
Map
<
Item
<
T
>>
;
private
head
:
Item
<
T
>
;
private
tail
:
Item
<
T
>
;
private
_length
:
number
;
constructor
()
{
this
.
map
=
Object
.
create
(
null
);
this
.
head
=
undefined
;
this
.
tail
=
undefined
;
this
.
_length
=
0
;
}
public
isEmpty
():
boolean
{
return
!
this
.
head
&&
!
this
.
tail
;
}
public
length
():
number
{
return
this
.
_length
;
}
public
get
(
key
:
string
):
T
{
const
item
=
this
.
map
[
key
];
if
(
!
item
)
{
return
undefined
;
}
return
item
.
value
;
}
public
add
(
key
:
string
,
value
:
T
,
touch
=
false
):
void
{
let
item
=
this
.
map
[
key
];
if
(
item
)
{
item
.
value
=
value
;
if
(
touch
)
{
this
.
touch
(
item
);
}
}
else
{
item
=
{
key
,
value
,
next
:
undefined
,
previous
:
undefined
};
if
(
touch
)
{
this
.
addItemFirst
(
item
);
}
else
{
this
.
addItemLast
(
item
);
}
this
.
map
[
key
]
=
item
;
this
.
_length
++
;
}
}
public
remove
(
key
:
string
):
T
{
const
item
=
this
.
map
[
key
];
if
(
!
item
)
{
return
undefined
;
}
delete
this
.
map
[
key
];
this
.
removeItem
(
item
);
this
.
_length
--
;
return
item
.
value
;
}
public
shift
():
T
{
if
(
!
this
.
head
&&
!
this
.
tail
)
{
return
undefined
;
}
const
item
=
this
.
head
;
delete
this
.
map
[
item
.
key
];
this
.
removeItem
(
item
);
this
.
_length
--
;
return
item
.
value
;
}
private
addItemFirst
(
item
:
Item
<
T
>
):
void
{
// First time Insert
if
(
!
this
.
head
&&
!
this
.
tail
)
{
this
.
tail
=
item
;
}
else
{
item
.
next
=
this
.
head
;
this
.
head
.
previous
=
item
;
}
this
.
head
=
item
;
}
private
addItemLast
(
item
:
Item
<
T
>
):
void
{
// First time Insert
if
(
!
this
.
head
&&
!
this
.
tail
)
{
this
.
head
=
item
;
}
else
{
item
.
previous
=
this
.
tail
;
this
.
tail
.
next
=
item
;
}
this
.
tail
=
item
;
}
private
removeItem
(
item
:
Item
<
T
>
):
void
{
if
(
item
===
this
.
head
&&
item
===
this
.
tail
)
{
this
.
head
=
undefined
;
this
.
tail
=
undefined
;
}
else
if
(
item
===
this
.
head
)
{
this
.
head
=
item
.
next
;
}
else
if
(
item
===
this
.
tail
)
{
this
.
tail
=
item
.
previous
;
}
else
{
const
next
=
item
.
next
;
const
previous
=
item
.
previous
;
next
.
previous
=
previous
;
previous
.
next
=
next
;
}
}
private
touch
(
item
:
Item
<
T
>
):
void
{
if
(
item
===
this
.
head
)
{
return
;
}
const
next
=
item
.
next
;
const
previous
=
item
.
previous
;
// Unlink the item
if
(
item
===
this
.
tail
)
{
this
.
tail
=
previous
;
}
else
{
// Both next and previous are not null since item was neither head nor tail.
next
.
previous
=
previous
;
previous
.
next
=
next
;
}
// Insert the node at head
item
.
previous
=
undefined
;
item
.
next
=
this
.
head
;
this
.
head
.
previous
=
item
;
this
.
head
=
item
;
}
}
extensions/typescript/src/protocol.
d.
ts
→
extensions/typescript/src/protocol.ts
浏览文件 @
b2fe50a8
此差异已折叠。
点击以展开。
extensions/typescript/src/typescriptService.ts
浏览文件 @
b2fe50a8
...
...
@@ -75,5 +75,8 @@ export interface ITypescriptServiceClient {
execute
(
command
:
'
projectInfo
'
,
args
:
Proto
.
ProjectInfoRequestArgs
,
token
?:
CancellationToken
):
Promise
<
Proto
.
ProjectInfoResponse
>
;
execute
(
command
:
'
reloadProjects
'
,
args
:
any
,
expectedResult
:
boolean
,
token
?:
CancellationToken
):
Promise
<
any
>
;
execute
(
command
:
'
reload
'
,
args
:
Proto
.
ReloadRequestArgs
,
expectedResult
:
boolean
,
token
?:
CancellationToken
):
Promise
<
any
>
;
execute
(
command
:
'
compilerOptionsForInferredProjects
'
,
args
:
Proto
.
SetCompilerOptionsForInferredProjectsArgs
,
token
?:
CancellationToken
):
Promise
<
any
>
;
execute
(
command
:
'
compileOnSaveAffectedFileList
'
,
args
:
Proto
.
CompileOnSaveEmitFileRequestArgs
,
token
?:
CancellationToken
):
Promise
<
Proto
.
CompileOnSaveAffectedFileListResponse
>
;
execute
(
command
:
'
compileOnSaveEmitFile
'
,
args
:
Proto
.
CompileOnSaveEmitFileRequestArgs
,
token
?:
CancellationToken
):
Promise
<
any
>
;
execute
(
command
:
string
,
args
:
any
,
expectedResult
:
boolean
|
CancellationToken
,
token
?:
CancellationToken
):
Promise
<
any
>
;
}
\ No newline at end of file
extensions/typescript/src/typescriptServiceClient.ts
浏览文件 @
b2fe50a8
...
...
@@ -491,16 +491,30 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
}
private
serviceStarted
(
resendModels
:
boolean
):
void
{
let
configureOptions
:
Proto
.
ConfigureRequestArguments
=
{
hostInfo
:
'
vscode
'
,
useOneInferredProject
:
true
};
if
(
this
.
_experimentalAutoBuild
&&
this
.
storagePath
)
{
try
{
fs
.
mkdirSync
(
this
.
storagePath
);
}
catch
(
error
)
{
}
this
.
execute
(
'
configure
'
,
{
autoBuild
:
true
,
metaDataDirectory
:
this
.
storagePath
});
}
configureOptions
.
autoDiagnostics
=
true
;
configureOptions
.
metaDataDirectory
=
this
.
storagePath
;
}
this
.
execute
(
'
configure
'
,
configureOptions
);
let
compilerOptions
:
Proto
.
ExternalProjectCompilerOptions
=
{
module
:
Proto
.
ModuleKind
.
CommonJS
,
target
:
Proto
.
ScriptTarget
.
ES5
,
allowJs
:
true
,
allowSyntheticDefaultImports
:
true
};
let
args
:
Proto
.
SetCompilerOptionsForInferredProjectsArgs
=
{
options
:
compilerOptions
};
this
.
execute
(
'
compilerOptionsForInferredProjects
'
,
args
);
if
(
resendModels
)
{
this
.
host
.
populateService
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录