Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
4cbca845
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,发现更多精彩内容 >>
提交
4cbca845
编写于
10月 29, 2015
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check for displaying script directive help to avoid interfere with other interactive window
上级
1170212b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
31 deletion
+43
-31
src/InteractiveWindow/Editor/Commands/InteractiveWindowCommands.cs
...activeWindow/Editor/Commands/InteractiveWindowCommands.cs
+17
-9
src/InteractiveWindow/Editor/InteractiveWindowResources.Designer.cs
...ctiveWindow/Editor/InteractiveWindowResources.Designer.cs
+12
-11
src/InteractiveWindow/Editor/InteractiveWindowResources.resx
src/InteractiveWindow/Editor/InteractiveWindowResources.resx
+2
-2
src/InteractiveWindow/EditorTest/InteractiveWindowTests.cs
src/InteractiveWindow/EditorTest/InteractiveWindowTests.cs
+4
-4
src/Scripting/CSharpTest/CommandLineRunnerTests.cs
src/Scripting/CSharpTest/CommandLineRunnerTests.cs
+3
-0
src/Scripting/Core/ScriptingResources.Designer.cs
src/Scripting/Core/ScriptingResources.Designer.cs
+2
-2
src/Scripting/Core/ScriptingResources.resx
src/Scripting/Core/ScriptingResources.resx
+3
-3
未找到文件。
src/InteractiveWindow/Editor/Commands/InteractiveWindowCommands.cs
浏览文件 @
4cbca845
...
...
@@ -53,7 +53,8 @@ internal Commands(IInteractiveWindow window, string prefix, IEnumerable<IInterac
{
length
+=
_commandSeparator
.
Length
;
}
length
+=
name
.
Length
;
// plus the length of `#` for display purpose
length
+=
name
.
Length
+
1
;
commandsDict
[
name
]
=
command
;
}
...
...
@@ -167,7 +168,7 @@ internal IEnumerable<string> Help()
{
string
format
=
"{0,-"
+
_maxCommandNameLength
+
"} {1}"
;
return
_commands
.
GroupBy
(
entry
=>
entry
.
Value
).
Select
(
group
=>
string
.
Format
(
format
,
string
.
Join
(
_commandSeparator
,
group
.
Key
.
Names
),
group
.
Key
.
Description
)).
Select
(
group
=>
string
.
Format
(
format
,
string
.
Join
(
_commandSeparator
,
group
.
Key
.
Names
.
Select
(
s
=>
"#"
+
s
)
),
group
.
Key
.
Description
)).
OrderBy
(
line
=>
line
);
}
...
...
@@ -256,10 +257,10 @@ private async Task<ExecutionResult> ExecuteCommandAsync(IInteractiveWindowComman
"Ctrl-A "
+
InteractiveWindowResources
.
CtrlAHelp
,
};
private
static
readonly
string
[]
s_
s
criptDirectives
=
new
[]
private
static
readonly
string
[]
s_
CSVBS
criptDirectives
=
new
[]
{
"
r
"
+
InteractiveWindowResources
.
RefHelp
,
"
load
"
+
InteractiveWindowResources
.
LoadHelp
"
#r
"
+
InteractiveWindowResources
.
RefHelp
,
"
#load
"
+
InteractiveWindowResources
.
LoadHelp
};
public
void
DisplayHelp
()
...
...
@@ -278,11 +279,18 @@ public void DisplayHelp()
_window
.
WriteLine
(
line
);
}
_window
.
WriteLine
(
InteractiveWindowResources
.
ScriptDirectives
);
foreach
(
var
line
in
s_scriptDirectives
)
// Hack: Display script directives only in CS/VB interactive window
// TODO: https://github.com/dotnet/roslyn/issues/6441
var
evaluatorTypeName
=
_window
.
Evaluator
.
GetType
().
Name
;
if
(
evaluatorTypeName
==
"CSharpInteractiveEvaluator"
||
evaluatorTypeName
==
"VisualBasicInteractiveEvaluator"
)
{
_window
.
Write
(
HelpIndent
);
_window
.
WriteLine
(
line
);
_window
.
WriteLine
(
InteractiveWindowResources
.
CSVBScriptDirectives
);
foreach
(
var
line
in
s_CSVBScriptDirectives
)
{
_window
.
Write
(
HelpIndent
);
_window
.
WriteLine
(
line
);
}
}
}
...
...
src/InteractiveWindow/Editor/InteractiveWindowResources.Designer.cs
浏览文件 @
4cbca845
...
...
@@ -10,6 +10,7 @@
namespace
Microsoft.VisualStudio.InteractiveWindow
{
using
System
;
using
System.Reflection
;
/// <summary>
...
...
@@ -39,7 +40,7 @@ internal class InteractiveWindowResources {
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
if
(
object
.
ReferenceEquals
(
resourceMan
,
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"Microsoft.VisualStudio.InteractiveWindow.InteractiveWindowResources"
,
typeof
(
InteractiveWindowResources
).
Assembly
);
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"Microsoft.VisualStudio.InteractiveWindow.InteractiveWindowResources"
,
typeof
(
InteractiveWindowResources
).
GetTypeInfo
().
Assembly
);
resourceMan
=
temp
;
}
return
resourceMan
;
...
...
@@ -114,6 +115,15 @@ internal class InteractiveWindowResources {
}
}
/// <summary>
/// Looks up a localized string similar to Script directives:.
/// </summary>
internal
static
string
CSVBScriptDirectives
{
get
{
return
ResourceManager
.
GetString
(
"CSVBScriptDirectives"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to First press, select the submission containing the cursor. Second press, select all text in the window..
/// </summary>
...
...
@@ -295,7 +305,7 @@ internal class InteractiveWindowResources {
}
/// <summary>
/// Looks up a localized string similar to Add a metadata reference to specified assembly, e.g. #r "myLib.dll"..
/// Looks up a localized string similar to Add a metadata reference to specified assembly
and all its dependencies
, e.g. #r "myLib.dll"..
/// </summary>
internal
static
string
RefHelp
{
get
{
...
...
@@ -348,15 +358,6 @@ internal class InteractiveWindowResources {
}
}
/// <summary>
/// Looks up a localized string similar to Script directives:.
/// </summary>
internal
static
string
ScriptDirectives
{
get
{
return
ResourceManager
.
GetString
(
"ScriptDirectives"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Insert a new line..
/// </summary>
...
...
src/InteractiveWindow/Editor/InteractiveWindowResources.resx
浏览文件 @
4cbca845
...
...
@@ -228,11 +228,11 @@
<data
name=
"Paste"
xml:space=
"preserve"
>
<value>
Paste
</value>
</data>
<data
name=
"ScriptDirectives"
xml:space=
"preserve"
>
<data
name=
"
CSVB
ScriptDirectives"
xml:space=
"preserve"
>
<value>
Script directives:
</value>
</data>
<data
name=
"RefHelp"
xml:space=
"preserve"
>
<value>
Add a metadata reference to specified assembly, e.g. #r "myLib.dll".
</value>
<value>
Add a metadata reference to specified assembly
and all its dependencies
, e.g. #r "myLib.dll".
</value>
</data>
<data
name=
"LoadHelp"
xml:space=
"preserve"
>
<value>
Load specified script file and execute it, e.g. #load "myScript.csx".
</value>
...
...
src/InteractiveWindow/EditorTest/InteractiveWindowTests.cs
浏览文件 @
4cbca845
...
...
@@ -175,10 +175,10 @@ public void InteractiveWindow_GetCommands()
var
commands
=
interactiveCommands
.
GetCommands
();
Assert
.
NotEmpty
(
commands
);
Assert
.
Equal
(
2
,
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"cls"
).
Count
());
Assert
.
Equal
(
2
,
commands
.
Where
(
n
=>
n
.
Names
.
Last
()
==
"clear"
).
Count
());
Assert
.
NotNull
(
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"help"
).
SingleOrDefault
());
Assert
.
NotNull
(
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"reset"
).
SingleOrDefault
());
Assert
.
Equal
(
2
,
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"
#
cls"
).
Count
());
Assert
.
Equal
(
2
,
commands
.
Where
(
n
=>
n
.
Names
.
Last
()
==
"
#
clear"
).
Count
());
Assert
.
NotNull
(
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"
#
help"
).
SingleOrDefault
());
Assert
.
NotNull
(
commands
.
Where
(
n
=>
n
.
Names
.
First
()
==
"
#
reset"
).
SingleOrDefault
());
}
[
WorkItem
(
3970
,
"https://github.com/dotnet/roslyn/issues/3970"
)]
...
...
src/Scripting/CSharpTest/CommandLineRunnerTests.cs
浏览文件 @
4cbca845
...
...
@@ -504,6 +504,9 @@ public void HelpCommand()
DownArrow Replace the current submission with a subsequent submission (after having previously navigated backwards).
REPL commands:
#help Display help on available commands and key bindings.
Script directives:
#r Add a metadata reference to specified assembly and all its dependencies, e.g. #r ""myLib.dll"".
#load Load specified script file and execute it, e.g. #load ""myScript.csx"".
> "
,
runner
.
Console
.
Out
.
ToString
());
}
}
...
...
src/Scripting/Core/ScriptingResources.Designer.cs
浏览文件 @
4cbca845
...
...
@@ -158,9 +158,9 @@ internal class ScriptingResources {
/// UpArrow Replace the current submission with a previous submission.
/// DownArrow Replace the current submission with a subsequent submission (after having previously navigated backwards).
///REPL commands:
///
help
Display help on available commands and key bindings.
///
#help
Display help on available commands and key bindings.
///Script directives:
///
r
Add a metad [rest of string was truncated]";.
///
#r
Add a metad [rest of string was truncated]";.
/// </summary>
internal
static
string
HelpText
{
get
{
...
...
src/Scripting/Core/ScriptingResources.resx
浏览文件 @
4cbca845
...
...
@@ -156,9 +156,9 @@
UpArrow Replace the current submission with a previous submission.
DownArrow Replace the current submission with a subsequent submission (after having previously navigated backwards).
REPL commands:
help
Display help on available commands and key bindings.
#help
Display help on available commands and key bindings.
Script directives:
r Add a metadata reference to specified assembly
, e.g. #r "myLib.dll".
load
Load specified script file and execute it, e.g. #load "myScript.csx".
</value>
#r Add a metadata reference to specified assembly and all its dependencies
, e.g. #r "myLib.dll".
#load
Load specified script file and execute it, e.g. #load "myScript.csx".
</value>
</data>
</root>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录