Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9b82ff15
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b82ff15
编写于
1月 24, 2020
作者:
J
Jason Malinowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Project.RemoveDocuments() as a helper method as well
上级
f3a71f06
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
105 addition
and
0 deletion
+105
-0
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
+1
-0
src/Workspaces/Core/Portable/Workspace/Solution/Project.cs
src/Workspaces/Core/Portable/Workspace/Solution/Project.cs
+18
-0
src/Workspaces/Core/Portable/WorkspacesResources.resx
src/Workspaces/Core/Portable/WorkspacesResources.resx
+3
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf
...orkspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf
src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf
...kspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf
+5
-0
src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf
...kspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf
+5
-0
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
+18
-0
未找到文件。
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
9b82ff15
*REMOVED*Microsoft.CodeAnalysis.TextDocument.Project.set -> void
*REMOVED*Microsoft.CodeAnalysis.TextDocument.TextDocument() -> void
Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, T value) -> Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Project.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithOptions(Microsoft.CodeAnalysis.Options.OptionSet options) -> Microsoft.CodeAnalysis.Solution
static Microsoft.CodeAnalysis.Formatting.Formatter.OrganizeImportsAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
...
...
src/Workspaces/Core/Portable/Workspace/Solution/Project.cs
浏览文件 @
9b82ff15
...
...
@@ -14,6 +14,7 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Text
;
using
Roslyn.Collections.Immutable
;
using
Roslyn.Utilities
;
...
...
@@ -604,6 +605,23 @@ public Project RemoveDocument(DocumentId documentId)
return
this
.
Solution
.
RemoveDocument
(
documentId
).
GetProject
(
this
.
Id
)!;
}
/// <summary>
/// Creates a new instance of this project updated to no longer include the specified documents.
/// </summary>
public
Project
RemoveDocuments
(
ImmutableArray
<
DocumentId
>
documentIds
)
{
foreach
(
var
documentId
in
documentIds
)
{
// Handling of null entries is handled by Solution.RemoveDocuments.
if
(
documentId
?.
ProjectId
!=
this
.
Id
)
{
throw
new
ArgumentException
(
string
.
Format
(
WorkspacesResources
.
_0_is_in_a_different_project
,
documentId
));
}
}
return
this
.
Solution
.
RemoveDocuments
(
documentIds
).
GetRequiredProject
(
this
.
Id
);
}
/// <summary>
/// Creates a new instance of this project updated to no longer include the specified additional document.
/// </summary>
...
...
src/Workspaces/Core/Portable/WorkspacesResources.resx
浏览文件 @
9b82ff15
...
...
@@ -1440,4 +1440,7 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<data
name=
"Document_does_not_support_syntax_trees"
xml:space=
"preserve"
>
<value>
Document does not support syntax trees
</value>
</data>
<data
name=
"_0_is_in_a_different_project"
xml:space=
"preserve"
>
<value>
{0} is in a different project.
</value>
</data>
</root>
\ No newline at end of file
src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv
<target
state=
"translated"
>
Pracovní prostor není platný.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0} není součástí pracovního prostoru.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg
<target
state=
"translated"
>
Arbeitsbereich ist nicht leer.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'"{0}" ist nicht Teil des Arbeitsbereichs.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us
<target
state=
"translated"
>
El área de trabajo no está vacía.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' no es parte del área de trabajo.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée
<target
state=
"translated"
>
L'espace de travail n'est pas vide.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' ne fait pas partie de l'espace de travail.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all'
<target
state=
"translated"
>
L'area di lavoro non è vuota.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' non fa parte dell'area di lavoro.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<target
state=
"translated"
>
ワークスペースが空ではありません。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' はワークスペースの一部ではありません。
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<target
state=
"translated"
>
작업 영역이 비어 있지 않습니다.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}'은(는) 작업 영역의 일부가 아닙니다.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk
<target
state=
"translated"
>
Obszar roboczy nie jest pusty.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'Element „{0}” nie jest częścią obszaru roboczego.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas
<target
state=
"translated"
>
Workspace não está vazio.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
"{0}" não é parte do workspace.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<target
state=
"translated"
>
Рабочая область не пуста.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'"{0}" не является частью рабочей области.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri
<target
state=
"translated"
>
Çalışma alanı boş değil.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' çalışma alanının parçası değildir.
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<target
state=
"translated"
>
工作区不为空。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'“{0}”不是工作区的一部分。
</target>
...
...
src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf
浏览文件 @
9b82ff15
...
...
@@ -1317,6 +1317,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of
<target
state=
"translated"
>
工作區不是空的。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_in_a_different_project"
>
<source>
{0} is in a different project.
</source>
<target
state=
"new"
>
{0} is in a different project.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"_0_is_not_part_of_the_workspace"
>
<source>
'{0}' is not part of the workspace.
</source>
<target
state=
"translated"
>
'{0}' 不是工作區的一部分。
</target>
...
...
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
浏览文件 @
9b82ff15
...
...
@@ -241,6 +241,24 @@ public void RemoveTwoDocumentsFromDifferentProjects()
Assert
.
All
(
solution
.
Projects
,
p
=>
Assert
.
Empty
(
p
.
Documents
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Workspace
)]
public
void
RemoveDocumentFromUnrelatedProject
()
{
var
projectId1
=
ProjectId
.
CreateNewId
();
var
projectId2
=
ProjectId
.
CreateNewId
();
var
documentInfo1
=
DocumentInfo
.
Create
(
DocumentId
.
CreateNewId
(
projectId1
),
"file1.cs"
);
var
solution
=
CreateSolution
()
.
AddProject
(
projectId1
,
"project1"
,
"project1.dll"
,
LanguageNames
.
CSharp
)
.
AddProject
(
projectId2
,
"project2"
,
"project2.dll"
,
LanguageNames
.
CSharp
)
.
AddDocument
(
documentInfo1
);
// This should throw if we're removing one document from the wrong project. Right now we don't test the RemoveDocument
// API due to https://github.com/dotnet/roslyn/issues/41211.
Assert
.
Throws
<
ArgumentException
>(()
=>
solution
.
GetProject
(
projectId2
).
RemoveDocuments
(
ImmutableArray
.
Create
(
documentInfo1
.
Id
)));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Workspace
)]
public
async
Task
TestOneCSharpProjectAsync
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录