Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4a3c868b
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,发现更多精彩内容 >>
提交
4a3c868b
编写于
12月 02, 2015
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use URI in favour of URL
上级
a436a255
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
29 addition
and
31 deletion
+29
-31
src/vs/base/common/network.ts
src/vs/base/common/network.ts
+8
-2
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
+5
-5
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+0
-1
src/vs/editor/common/model/mirrorModel.ts
src/vs/editor/common/model/mirrorModel.ts
+1
-1
src/vs/editor/common/model/model.ts
src/vs/editor/common/model/model.ts
+5
-7
src/vs/editor/common/services/modelServiceImpl.ts
src/vs/editor/common/services/modelServiceImpl.ts
+2
-3
src/vs/platform/markers/common/problemMatcher.ts
src/vs/platform/markers/common/problemMatcher.ts
+1
-2
src/vs/workbench/parts/search/test/common/searchModel.test.ts
...vs/workbench/parts/search/test/common/searchModel.test.ts
+5
-6
src/vs/workbench/test/common/api/extHostLanguageFeatureCommands.test.ts
...ch/test/common/api/extHostLanguageFeatureCommands.test.ts
+1
-2
src/vs/workbench/test/common/api/extHostLanguageFeatures.test.ts
...workbench/test/common/api/extHostLanguageFeatures.test.ts
+1
-2
未找到文件。
src/vs/base/common/network.ts
浏览文件 @
4a3c868b
...
...
@@ -300,7 +300,13 @@ export class URL extends URI implements objects.IEqualable {
}
public
static
fromUri
(
value
:
URI
):
URL
{
return
value
&&
new
URL
(
value
);
if
(
!
value
)
{
return
<
any
>
value
;
}
else
if
(
value
instanceof
URL
)
{
return
value
;
}
else
{
return
new
URL
(
value
);
}
}
private
_spec
:
string
;
...
...
@@ -309,7 +315,7 @@ export class URL extends URI implements objects.IEqualable {
constructor
(
spec
:
string
);
constructor
(
spec
:
URI
);
constructor
(
stringOrURI
:
any
)
{
constructor
(
stringOrURI
:
string
|
URI
)
{
super
();
assert
.
ok
(
!!
stringOrURI
,
'
spec must not be null
'
);
if
(
typeof
stringOrURI
===
'
string
'
)
{
...
...
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
浏览文件 @
4a3c868b
...
...
@@ -13,7 +13,7 @@ import EditorCommon = require('vs/editor/common/editorCommon');
import
Modes
=
require
(
'
vs/editor/common/modes
'
);
import
standaloneServices
=
require
(
'
vs/editor/browser/standalone/standaloneServices
'
);
import
Platform
=
require
(
'
vs/platform/platform
'
);
import
Network
=
require
(
'
vs/base/common/network
'
)
;
import
URI
from
'
vs/base/common/uri
'
;
import
Model
=
require
(
'
vs/editor/common/model/model
'
);
import
Lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
MonarchTypes
=
require
(
'
vs/editor/common/modes/monarch/monarchTypes
'
);
...
...
@@ -346,7 +346,7 @@ function prepareServices(domElement: HTMLElement, services: standaloneServices.I
};
}
function
createModelWithRegistryMode
(
modelService
:
IModelService
,
modeService
:
IModeService
,
value
:
string
,
modeName
:
string
,
associatedResource
?:
Network
.
URL
):
EditorCommon
.
IModel
{
function
createModelWithRegistryMode
(
modelService
:
IModelService
,
modeService
:
IModeService
,
value
:
string
,
modeName
:
string
,
associatedResource
?:
URI
):
EditorCommon
.
IModel
{
var
modeInformation
=
modeService
.
lookup
(
modeName
);
if
(
modeInformation
.
length
>
0
)
{
// Force usage of the first existing mode
...
...
@@ -362,13 +362,13 @@ function createModelWithRegistryMode(modelService:IModelService, modeService:IMo
return
modelService
.
createModel
(
value
,
modeService
.
getOrCreateMode
(
modeName
),
associatedResource
);
}
export
function
createModel
(
value
:
string
,
mode
:
string
|
MonarchTypes
.
ILanguage
|
Modes
.
IMode
,
associatedResource
?:
Network
.
URL
|
string
):
EditorCommon
.
IModel
{
export
function
createModel
(
value
:
string
,
mode
:
string
|
MonarchTypes
.
ILanguage
|
Modes
.
IMode
,
associatedResource
?:
URI
|
string
):
EditorCommon
.
IModel
{
startup
.
initStaticServicesIfNecessary
();
var
modelService
=
standaloneServices
.
ensureStaticPlatformServices
(
null
).
modelService
;
var
resource
:
Network
.
URL
;
var
resource
:
URI
;
if
(
typeof
associatedResource
===
'
string
'
)
{
resource
=
new
Network
.
URL
(
associatedResource
);
resource
=
URI
.
parse
(
associatedResource
);
}
else
{
// must be a URL
resource
=
associatedResource
;
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
4a3c868b
...
...
@@ -1766,7 +1766,6 @@ export interface IModel extends IEditableTextModel, ITextModelWithMarkers, IToke
onBeforeDetached
():
void
;
getURL
():
URL
;
getModeId
():
string
;
/**
...
...
src/vs/editor/common/model/mirrorModel.ts
浏览文件 @
4a3c868b
...
...
@@ -36,7 +36,7 @@ export class AbstractMirrorModel extends TextModelWithTokens implements EditorCo
}
this
.
_setVersionId
(
versionId
);
this
.
_associatedResource
=
associatedResource
&&
URL
.
fromUri
(
associatedResource
);
this
.
_associatedResource
=
URL
.
fromUri
(
associatedResource
);
this
.
_extraProperties
=
properties
;
}
...
...
src/vs/editor/common/model/model.ts
浏览文件 @
4a3c868b
...
...
@@ -10,6 +10,7 @@ import {TextModel} from 'vs/editor/common/model/textModel';
import
{
EditableTextModel
}
from
'
vs/editor/common/model/editableTextModel
'
;
import
EditorCommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
{
URL
}
from
'
vs/base/common/network
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
Objects
=
require
(
'
vs/base/common/objects
'
);
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -56,7 +57,7 @@ export class Model extends EditableTextModel implements EditorCommon.IModel {
* The resource associated with this model. If the value is not provided an
* unique in memory URL is constructed as the associated resource.
*/
constructor
(
rawText
:
string
,
modeOrPromise
:
IMode
|
TPromise
<
IMode
>
,
associatedResource
:
UR
L
=
null
)
{
constructor
(
rawText
:
string
,
modeOrPromise
:
IMode
|
TPromise
<
IMode
>
,
associatedResource
:
UR
I
=
null
)
{
super
([
EditorCommon
.
EventType
.
ModelPropertiesChanged
,
EditorCommon
.
EventType
.
ModelDispose
...
...
@@ -67,10 +68,11 @@ export class Model extends EditableTextModel implements EditorCommon.IModel {
this
.
id
=
'
$model
'
+
MODEL_ID
;
if
(
typeof
associatedResource
===
'
undefined
'
||
associatedResource
===
null
)
{
associatedResource
=
new
URL
(
'
inmemory://model/
'
+
MODEL_ID
);
this
.
_associatedResource
=
new
URL
(
'
inmemory://model/
'
+
MODEL_ID
);
}
else
{
this
.
_associatedResource
=
URL
.
fromUri
(
associatedResource
);
}
this
.
_associatedResource
=
associatedResource
;
if
(
aliveModels
[
String
(
this
.
_associatedResource
)])
{
throw
new
Error
(
'
Cannot instantiate a second Model with the same URI!
'
);
...
...
@@ -83,10 +85,6 @@ export class Model extends EditableTextModel implements EditorCommon.IModel {
// console.log('ALIVE MODELS: ' + Object.keys(aliveModels).join('\n'));
}
public
getURL
():
URL
{
return
this
.
_associatedResource
;
}
public
getModeId
():
string
{
return
this
.
getMode
().
getId
();
}
...
...
src/vs/editor/common/services/modelServiceImpl.ts
浏览文件 @
4a3c868b
...
...
@@ -18,7 +18,6 @@ import {AllWorkersAttr} from 'vs/platform/thread/common/threadService';
import
{
IHTMLContentElement
}
from
'
vs/base/common/htmlContent
'
;
import
{
EventSource
}
from
'
vs/base/common/eventSource
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
URL
}
from
'
vs/base/common/network
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
EventProvider
}
from
'
vs/base/common/eventProvider
'
;
import
{
IDisposable
,
disposeAll
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -221,7 +220,7 @@ export class ModelServiceImpl implements IModelService {
private
_createModelData
(
value
:
string
,
modeOrPromise
:
TPromise
<
Modes
.
IMode
>|
Modes
.
IMode
,
resource
:
URI
):
ModelData
{
// create & save the model
let
model
=
new
Model
(
value
,
modeOrPromise
,
resource
&&
URL
.
fromUri
(
resource
)
);
let
model
=
new
Model
(
value
,
modeOrPromise
,
resource
);
let
modelId
=
MODEL_ID
(
model
.
getAssociatedResource
());
if
(
this
.
_models
[
modelId
])
{
...
...
@@ -390,7 +389,7 @@ export class ModelServiceWorkerHelper {
public
$_acceptNewModel
(
data
:
IRawModelData
):
TPromise
<
void
>
{
// Create & insert the mirror model eagerly in the resource service
let
mirrorModel
=
new
MirrorModel
(
this
.
_resourceService
,
data
.
versionId
,
data
.
value
,
null
,
URL
.
fromUri
(
data
.
url
)
,
data
.
properties
);
let
mirrorModel
=
new
MirrorModel
(
this
.
_resourceService
,
data
.
versionId
,
data
.
value
,
null
,
data
.
url
,
data
.
properties
);
this
.
_resourceService
.
insert
(
mirrorModel
.
getAssociatedResource
(),
mirrorModel
);
// Block worker execution until the mode is instantiated
...
...
src/vs/platform/markers/common/problemMatcher.ts
浏览文件 @
4a3c868b
...
...
@@ -10,7 +10,6 @@ import * as Objects from 'vs/base/common/objects';
import
*
as
Strings
from
'
vs/base/common/strings
'
;
import
*
as
Assert
from
'
vs/base/common/assert
'
;
import
*
as
Paths
from
'
vs/base/common/paths
'
;
import
*
as
NetWork
from
'
vs/base/common/network
'
;
import
*
as
Types
from
'
vs/base/common/types
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
URI
from
'
vs/base/common/uri
'
;
...
...
@@ -171,7 +170,7 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI {
if
(
fullPath
[
0
]
!==
'
/
'
)
{
fullPath
=
'
/
'
+
fullPath
;
}
return
NetWork
.
URL
.
fromValu
e
(
'
file://
'
+
fullPath
);
return
URI
.
pars
e
(
'
file://
'
+
fullPath
);
}
export
interface
ILineMatcher
{
...
...
src/vs/workbench/parts/search/test/common/searchModel.test.ts
浏览文件 @
4a3c868b
...
...
@@ -7,17 +7,16 @@
import
*
as
assert
from
'
assert
'
;
import
{
Match
,
FileMatch
,
SearchResult
}
from
'
vs/workbench/parts/search/common/searchModel
'
;
import
model
=
require
(
'
vs/editor/common/model/model
'
);
import
{
URL
}
from
'
vs/base/common/network
'
;
import
{
EventSource
}
from
'
vs/base/common/eventSource
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
create
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
TestContextService
}
from
'
vs/workbench/test/browser/servicesTestUtils
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IFileMatch
}
from
'
vs/platform/search/common/search
'
;
function
toUri
(
path
:
string
):
uri
{
return
uri
.
file
(
'
C:
\\
'
+
path
);
function
toUri
(
path
:
string
):
URI
{
return
URI
.
file
(
'
C:
\\
'
+
path
);
}
suite
(
'
Search - Model
'
,
()
=>
{
...
...
@@ -27,7 +26,7 @@ suite('Search - Model', () => {
setup
(()
=>
{
let
event
=
new
EventSource
<
any
>
();
oneModel
=
new
model
.
Model
(
'
line1
\n
line2
\n
line3
'
,
null
,
UR
L
.
fromValu
e
(
'
file:///folder/file.txt
'
));
oneModel
=
new
model
.
Model
(
'
line1
\n
line2
\n
line3
'
,
null
,
UR
I
.
pars
e
(
'
file:///folder/file.txt
'
));
instantiation
=
create
({
modelService
:
{
getModel
:
()
=>
oneModel
,
...
...
@@ -85,7 +84,7 @@ suite('Search - Model', () => {
let
raw
:
IFileMatch
[]
=
[];
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
raw
.
push
({
resource
:
uri
.
parse
(
'
file://c:/
'
+
i
),
resource
:
URI
.
parse
(
'
file://c:/
'
+
i
),
lineMatches
:
[{
preview
:
String
(
i
),
lineNumber
:
1
,
...
...
src/vs/workbench/test/common/api/extHostLanguageFeatureCommands.test.ts
浏览文件 @
4a3c868b
...
...
@@ -9,7 +9,6 @@ import * as assert from 'assert';
import
{
setUnexpectedErrorHandler
,
errorHandler
}
from
'
vs/base/common/errors
'
;
import
{
create
}
from
'
vs/base/common/types
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
URL
}
from
'
vs/base/common/network
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
PluginHostDocument
}
from
'
vs/workbench/api/common/pluginHostDocuments
'
;
import
*
as
types
from
'
vs/workbench/api/common/pluginHostTypes
'
;
...
...
@@ -49,7 +48,7 @@ const model: EditorCommon.IModel = new EditorModel(
'
This is the third line
'
,
].
join
(
'
\n
'
),
undefined
,
UR
L
.
fromUri
(
URI
.
parse
(
'
far://testing/file.b
'
)
));
UR
I
.
parse
(
'
far://testing/file.b
'
));
let
extHost
:
ExtHostLanguageFeatures
;
let
mainThread
:
MainThreadLanguageFeatures
;
...
...
src/vs/workbench/test/common/api/extHostLanguageFeatures.test.ts
浏览文件 @
4a3c868b
...
...
@@ -9,7 +9,6 @@ import * as assert from 'assert';
import
{
setUnexpectedErrorHandler
,
errorHandler
}
from
'
vs/base/common/errors
'
;
import
{
create
}
from
'
vs/base/common/types
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
URL
}
from
'
vs/base/common/network
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
PluginHostDocument
}
from
'
vs/workbench/api/common/pluginHostDocuments
'
;
import
*
as
types
from
'
vs/workbench/api/common/pluginHostTypes
'
;
...
...
@@ -47,7 +46,7 @@ const model: EditorCommon.IModel = new EditorModel(
'
This is the third line
'
,
].
join
(
'
\n
'
),
undefined
,
UR
L
.
fromUri
(
URI
.
parse
(
'
far://testing/file.a
'
)
));
UR
I
.
parse
(
'
far://testing/file.a
'
));
let
extHost
:
ExtHostLanguageFeatures
;
let
mainThread
:
MainThreadLanguageFeatures
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录