提交 3988815f 编写于 作者: M manishv

Rollback changeset 1407857 to fix the build break. (changeset 1407952)

上级 1d5b512d
......@@ -3,12 +3,11 @@
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Editor.InteractiveWindow;
using Roslyn.Editor.InteractiveWindow.Commands;
namespace Microsoft.CodeAnalysis.Editor.CommandHandlers
{
[Export]
[ExportCommandHandler(PredefinedCommandHandlerNames.Completion, PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName)]
[ExportCommandHandler(PredefinedCommandHandlerNames.Completion, InteractiveContentTypeNames.InteractiveCommandContentType)]
[Order(After = PredefinedCommandHandlerNames.SignatureHelp)]
internal sealed class InteractiveCompletionCommandHandler : AbstractCompletionCommandHandler
{
......
......@@ -2,11 +2,10 @@
using System.ComponentModel.Composition;
using Roslyn.Editor.InteractiveWindow;
using Roslyn.Editor.InteractiveWindow.Commands;
namespace Microsoft.CodeAnalysis.Editor.CommandHandlers
{
[ExportCommandHandler(PredefinedCommandHandlerNames.IntelliSense, PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName)]
[ExportCommandHandler(PredefinedCommandHandlerNames.IntelliSense, InteractiveContentTypeNames.InteractiveCommandContentType)]
internal sealed class InteractiveIntelliSenseCommandHandler : AbstractIntelliSenseCommandHandler
{
[ImportingConstructor]
......
......@@ -8,13 +8,12 @@
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Editor.InteractiveWindow;
using Roslyn.Editor.InteractiveWindow.Commands;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Completion.Presentation
{
[Export(typeof(IIntelliSensePresenter<ICompletionPresenterSession, ICompletionSession>))]
[Export(typeof(ICompletionSourceProvider))]
[ContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName)]
[ContentType(InteractiveContentTypeNames.InteractiveCommandContentType)]
internal partial class CompletionPresenter : ForegroundThreadAffinitizedObject, IIntelliSensePresenter<ICompletionPresenterSession, ICompletionSession>, ICompletionSourceProvider
{
private readonly ICompletionBroker _completionBroker;
......
......@@ -6,7 +6,6 @@
using Microsoft.CodeAnalysis.Interactive;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Editor.InteractiveWindow;
using Roslyn.Editor.InteractiveWindow.Commands;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Interactive
{
......@@ -23,7 +22,7 @@ public InteractiveCommandContentTypeLanguageService(IContentTypeRegistryService
public IContentType GetDefaultContentType()
{
return _contentTypeRegistry.GetContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName);
return _contentTypeRegistry.GetContentType(InteractiveContentTypeNames.InteractiveCommandContentType);
}
}
}
......@@ -30,10 +30,6 @@
<Project>{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}</Project>
<Name>BasicCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\InteractiveWindow\Editor\InteractiveWindow.csproj">
<Project>{01e9bd68-0339-4a13-b42f-a3ca84d164f3}</Project>
<Name>InteractiveWindow</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Scripting\VisualBasic\BasicScripting.vbproj">
<Project>{3E7DEA65-317B-4F43-A25D-62F18D96CFD7}</Project>
<Name>BasicScripting</Name>
......@@ -66,6 +62,10 @@
<Project>{8E2A252E-A140-45A6-A81A-2652996EA589}</Project>
<Name>InteractiveFeatures</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\InteractiveWindow\Editor\InteractiveWindow.csproj">
<Project>{01E9BD68-0339-4A13-B42F-A3CA84D164F3}</Project>
<Name>InteractiveWindow</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\EditorFeatures\Text\TextEditorFeatures.csproj">
<Project>{18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}</Project>
<Name>TextEditorFeatures</Name>
......@@ -156,4 +156,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -11,7 +11,7 @@ internal sealed class ClearScreenCommand : InteractiveWindowCommand
{
public override Task<ExecutionResult> Execute(IInteractiveWindow window, string arguments)
{
window.Operations.ClearView();
window.ClearView();
return ExecutionResult.Succeeded;
}
......
......@@ -8,7 +8,7 @@
namespace Roslyn.Editor.InteractiveWindow.Commands
{
[Export(typeof(IClassifierProvider))]
[ContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName)]
[ContentType(InteractiveContentTypeNames.InteractiveCommandContentType)]
[TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class CommandClassifierProvider : IClassifierProvider
{
......
......@@ -60,7 +60,7 @@ internal Commands(IInteractiveWindow window, string prefix, IEnumerable<IInterac
this.classificationRegistry = classificationRegistry;
if (contentTypeRegistry != null)
{
this.commandContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName);
this.commandContentType = contentTypeRegistry.GetContentType(InteractiveContentTypeNames.InteractiveCommandContentType);
}
if (window != null)
......
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Utilities;
namespace Roslyn.Editor.InteractiveWindow.Commands
{
public static class PredefinedInteractiveCommandsContentTypes
{
public const string InteractiveCommandContentTypeName = "Interactive Command";
[Export, Name(InteractiveCommandContentTypeName), BaseDefinition("code")]
internal static readonly ContentTypeDefinition InteractiveCommandContentTypeDefinition;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.Utilities;
namespace Roslyn.Editor.InteractiveWindow
{
internal class ContentTypeMetadata
{
public IEnumerable<string> ContentTypes { get; private set; }
public ContentTypeMetadata(IDictionary<string, object> data)
{
this.ContentTypes = (IEnumerable<string>)data["ContentTypes"];
}
}
}
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Editor.InteractiveWindow;
namespace Microsoft.VisualStudio
namespace Roslyn.Editor.InteractiveWindow
{
internal class ContentTypeMetadata
public interface IContentTypeMetadata
{
public IEnumerable<string> ContentTypes { get; private set; }
public ContentTypeMetadata(IDictionary<string, object> data)
{
this.ContentTypes = (IEnumerable<string>)data["ContentTypes"];
}
IEnumerable<string> ContentTypes { get; }
}
internal static class ContentTypeMetadataHelpers
public static class ContentTypeMetadataHelpers
{
public static T OfContentType<T>(
this IEnumerable<Lazy<T, ContentTypeMetadata>> exports,
this IEnumerable<Lazy<T, IContentTypeMetadata>> exports,
IContentType contentType,
IContentTypeRegistryService contentTypeRegistry)
{
......
......@@ -55,6 +55,21 @@ IInteractiveEvaluator Evaluator
/// <returns>Returns a started task that finishes as soon as the initialization completes.</returns>
Task<ExecutionResult> InitializeAsync();
/// <summary>
/// Clears the REPL window screen.
/// </summary>
void ClearView();
/// <summary>
/// Clears the input history.
/// </summary>
void ClearHistory();
/// <summary>
/// Clears the current input.
/// </summary>
void Cancel();
/// <summary>
/// Closes the underlying text view.
/// </summary>
......@@ -88,6 +103,11 @@ IInteractiveEvaluator Evaluator
/// </remarks>
void Submit(IEnumerable<string> inputs);
/// <summary>
/// Resets the execution context clearing all variables.
/// </summary>
Task<ExecutionResult> ResetAsync(bool initialize = true);
/// <summary>
/// Aborts the current command which is executing.
///
......@@ -185,6 +205,40 @@ bool IsResetting
get;
}
/// <summary>
/// Attempts to insert a line break. Returns true if a line break is inserted, false if not.
///
/// Will not submit the input.
/// </summary>
bool BreakLine();
/// <summary>
/// Handles the user pressing return/enter.
///
/// If the caret is at the end of an input submits the current input. Otherwise if the caret is
/// in a language buffer it inserts a newline.
///
/// If not inside of a buffer the caret well be moved to the current language buffer if possible.
///
/// Returns true if the return was successfully processed.
/// </summary>
bool Return();
/// <summary>
/// Executes the current input regardless of the caret position within the input.
///
/// If the caret is in a previously executed input then the input is pasted to the
/// end of the current input and not executed.
/// </summary>
void ExecuteInput();
/// <summary>
/// If the current input is a standard input this will submit the input.
///
/// Returns true if the input was submitted, false otherwise.
/// </summary>
bool TrySubmitStandardInput();
/// <summary>
/// Appends a input into the editor buffer and history as if it has been executed.
///
......@@ -192,11 +246,74 @@ bool IsResetting
/// </summary>
void AddLogicalInput(string input);
IInteractiveWindowOperations Operations
{
get;
}
/// <summary>
/// Advances to the next item in history.
/// </summary>
void HistoryNext(string search = null);
/// <summary>
/// Advanced to the previous item in history.
/// </summary>
void HistoryPrevious(string search = null);
/// <summary>
/// If no search has been performed captures the current input as
/// the search string. Then searches through history for the next
/// match against the current search string.
/// </summary>
void HistorySearchNext();
/// <summary>
/// If no search has been performed captures the current input as
/// the search string. Then searches through history for the previous
/// match against the current search string.
/// </summary>
void HistorySearchPrevious();
/// <summary>
/// Deletes the current selection or the character before the caret.
/// </summary>
/// <returns></returns>
bool Backspace();
/// <summary>
/// Moves to the beginning of the line.
///
/// When in a language buffer the caret is moved to the beginning of the
/// input region not into the prompt region.
///
/// The caret is moved to the first non-whitespace character.
/// </summary>
/// <param name="extendSelection">True to extend the selection from the current caret position.</param>
void Home(bool extendSelection);
/// <summary>
/// Moves to the end of the line.
/// </summary>
/// <param name="extendSelection">True to extend the selection from the current caret position.</param>
void End(bool extendSelection);
/// <summary>
/// Selects all of the text in the buffer
/// </summary>
void SelectAll();
/// <summary>
/// Pastes the current clipboard contents into the interactive window.
/// </summary>
/// <returns></returns>
bool Paste();
/// <summary>
/// Cuts the current selection to the clipboard.
/// </summary>
void Cut();
/// <summary>
/// Deletes the current selection.
///
/// Returns true if the selection was deleted
/// </summary>
bool Delete();
}
}
using System.Threading.Tasks;
namespace Roslyn.Editor.InteractiveWindow
{
/// <summary>
/// Provides access to low level editor operations on the REPL window.
/// </summary>
public interface IInteractiveWindowOperations
{
/// <summary>
/// Deletes the current selection or the character before the caret.
/// </summary>
/// <returns></returns>
bool Backspace();
/// <summary>
/// Attempts to insert a line break. Returns true if a line break is inserted, false if not.
///
/// Will not submit the input.
/// </summary>
bool BreakLine();
/// <summary>
/// Clears the input history.
/// </summary>
void ClearHistory();
/// <summary>
/// Clears the REPL window screen.
/// </summary>
void ClearView();
/// <summary>
/// Advances to the next item in history.
/// </summary>
void HistoryNext(string search = null);
/// <summary>
/// Advanced to the previous item in history.
/// </summary>
void HistoryPrevious(string search = null);
/// <summary>
/// If no search has been performed captures the current input as
/// the search string. Then searches through history for the next
/// match against the current search string.
/// </summary>
void HistorySearchNext();
/// <summary>
/// If no search has been performed captures the current input as
/// the search string. Then searches through history for the previous
/// match against the current search string.
/// </summary>
void HistorySearchPrevious();
/// <summary>
/// Moves to the beginning of the line.
///
/// When in a language buffer the caret is moved to the beginning of the
/// input region not into the prompt region.
///
/// The caret is moved to the first non-whitespace character.
/// </summary>
/// <param name="extendSelection">True to extend the selection from the current caret position.</param>
void Home(bool extendSelection);
/// <summary>
/// Moves to the end of the line.
/// </summary>
/// <param name="extendSelection">True to extend the selection from the current caret position.</param>
void End(bool extendSelection);
/// <summary>
/// Selects all of the text in the buffer
/// </summary>
void SelectAll();
/// <summary>
/// Pastes the current clipboard contents into the interactive window.
/// </summary>
/// <returns></returns>
bool Paste();
/// <summary>
/// Cuts the current selection to the clipboard.
/// </summary>
void Cut();
/// <summary>
/// Deletes the current selection.
///
/// Returns true if the selection was deleted
/// </summary>
bool Delete();
/// <summary>
/// Handles the user pressing return/enter.
///
/// If the caret is at the end of an input submits the current input. Otherwise if the caret is
/// in a language buffer it inserts a newline.
///
/// If not inside of a buffer the caret well be moved to the current language buffer if possible.
///
/// Returns true if the return was successfully processed.
/// </summary>
bool Return();
/// <summary>
/// If the current input is a standard input this will submit the input.
///
/// Returns true if the input was submitted, false otherwise.
/// </summary>
bool TrySubmitStandardInput();
/// <summary>
/// Resets the execution context clearing all variables.
/// </summary>
Task<ExecutionResult> ResetAsync(bool initialize = true);
/// <summary>
/// Executes the current input regardless of the caret position within the input.
///
/// If the caret is in a previously executed input then the input is pasted to the
/// end of the current input and not executed.
/// </summary>
void ExecuteInput();
/// <summary>
/// Clears the current input.
/// </summary>
void Cancel();
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
namespace Roslyn.Editor.InteractiveWindow
{
public static class PredefinedInteractiveTextViewRoles
public static class InteractiveConstants
{
/// <summary>
/// The additional role found in any REPL editor window.
/// </summary>
public const string InteractiveTextViewRole = "REPL";
}
}
}
\ No newline at end of file
......@@ -3,12 +3,19 @@
namespace Roslyn.Editor.InteractiveWindow
{
internal static class InteractiveContentTypeDefinitions
public static class InteractiveContentTypeNames
{
[Export, Name(PredefinedInteractiveContentTypes.InteractiveContentTypeName), BaseDefinition("text"), BaseDefinition("projection")]
public const string InteractiveContentType = "Roslyn Interactive";
public const string InteractiveOutputContentType = "Roslyn Interactive Output";
public const string InteractiveCommandContentType = "Roslyn Interactive Command";
[Export, Name(InteractiveContentType), BaseDefinition("text"), BaseDefinition("projection")]
internal static readonly ContentTypeDefinition InteractiveContentTypeDefinition;
[Export, Name(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName), BaseDefinition("text")]
[Export, Name(InteractiveOutputContentType), BaseDefinition("text")]
internal static readonly ContentTypeDefinition InteractiveOutputContentTypeDefinition;
[Export, Name(InteractiveCommandContentType), BaseDefinition("code")]
internal static readonly ContentTypeDefinition InteractiveCommandContentTypeDefinition;
}
}
\ No newline at end of file
......@@ -48,7 +48,6 @@ internal class InteractiveWindow : IInteractiveWindow
private readonly IWpfTextView textView;
private readonly IEditorOperations editorOperations;
private readonly InteractiveOperations interactiveOperations;
private readonly History history;
private readonly TaskScheduler uiScheduler;
......@@ -143,7 +142,6 @@ internal class InteractiveWindow : IInteractiveWindow
this.host = host;
this.Properties = new PropertyCollection();
this.history = new History();
this.interactiveOperations = new InteractiveOperations(this);
this.projectionBufferFactory = projectionBufferFactory;
this.bufferFactory = bufferFactory;
......@@ -154,8 +152,8 @@ internal class InteractiveWindow : IInteractiveWindow
this.smartIndenterService = smartIndenterService;
var textContentType = contentTypeRegistry.GetContentType("text");
var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);
var replContentType = contentTypeRegistry.GetContentType(InteractiveContentTypeNames.InteractiveContentType);
var replOutputContentType = contentTypeRegistry.GetContentType(InteractiveContentTypeNames.InteractiveOutputContentType);
this.outputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
this.stdInputBuffer = bufferFactory.CreateTextBuffer();
......@@ -240,7 +238,7 @@ private ITextViewRoleSet CreateRoleSet()
PredefinedTextViewRoles.Editable,
PredefinedTextViewRoles.Interactive,
PredefinedTextViewRoles.Zoomable,
PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);
InteractiveConstants.InteractiveTextViewRole);
}
public void Close()
......@@ -1190,14 +1188,6 @@ public bool IsResetting
}
}
public IInteractiveWindowOperations Operations
{
get
{
return interactiveOperations;
}
}
public bool Delete()
{
historySearch = null;
......@@ -1644,7 +1634,7 @@ private string GetActiveCode()
/// <summary>
/// Sets the active code to the specified text w/o executing it.
/// </summary>
private void SetActiveCode(string text)
private void SetActiveCode(string text, object editTag = null)
{
// TODO (tomat): this should be handled by the language intellisense provider, not here:
var completionSession = this.SessionStack.TopSession;
......@@ -1653,7 +1643,7 @@ private void SetActiveCode(string text)
completionSession.Dismiss();
}
using (var edit = currentLanguageBuffer.CreateEdit(EditOptions.None, reiteratedVersionNumber: null, editTag: null))
using (var edit = currentLanguageBuffer.CreateEdit(EditOptions.None, reiteratedVersionNumber: null, editTag: editTag))
{
edit.Replace(new Span(0, currentLanguageBuffer.CurrentSnapshot.Length), text);
edit.Apply();
......@@ -1666,7 +1656,14 @@ private void SetActiveCode(string text)
/// <param name="entry"></param>
private void SetActiveCodeToHistory(History.Entry entry)
{
SetActiveCode(entry.Text);
object editTag = null;
if (entry.OriginalSpan.HasValue)
{
editTag = new RestoreHistoryEditTag(entry.OriginalSpan.Value);
}
SetActiveCode(entry.Text, editTag);
}
/// <summary>
......@@ -3019,110 +3016,5 @@ internal List<ReplSpan> ProjectionSpans
}
#endregion
class InteractiveOperations : IInteractiveWindowOperations
{
private readonly InteractiveWindow window;
public InteractiveOperations(InteractiveWindow window)
{
this.window = window;
}
public bool Backspace()
{
return window.Backspace();
}
public bool BreakLine()
{
return window.BreakLine();
}
public void Cancel()
{
window.Cancel();
}
public void ClearHistory()
{
window.ClearHistory();
}
public void ClearView()
{
window.ClearView();
}
public void Cut()
{
window.Cut();
}
public bool Delete()
{
return window.Delete();
}
public void End(bool extendSelection)
{
window.End(extendSelection);
}
public void ExecuteInput()
{
window.ExecuteInput();
}
public void HistoryNext(string search = null)
{
window.HistoryNext(search);
}
public void HistoryPrevious(string search = null)
{
window.HistoryPrevious(search);
}
public void HistorySearchNext()
{
window.HistorySearchNext();
}
public void HistorySearchPrevious()
{
window.HistorySearchPrevious();
}
public void Home(bool extendSelection)
{
window.Home(extendSelection);
}
public bool Paste()
{
return window.Paste();
}
public Task<ExecutionResult> ResetAsync(bool initialize = true)
{
return window.ResetAsync(initialize);
}
public bool Return()
{
return window.Return();
}
public void SelectAll()
{
window.SelectAll();
}
public bool TrySubmitStandardInput()
{
return window.TrySubmitStandardInput();
}
}
}
}
......@@ -10,7 +10,7 @@
<ProjectGuid>{01E9BD68-0339-4A13-B42F-A3CA84D164F3}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Roslyn.Editor.InteractiveWindow</RootNamespace>
<AssemblyName>Microsoft.VisualStudio.InteractiveWindow</AssemblyName>
<AssemblyName>Roslyn.InteractiveWindow</AssemblyName>
<!-- TODO -->
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
......@@ -97,7 +97,6 @@
<Compile Include="Commands\ClearScreenCommand.cs" />
<Compile Include="Commands\CommandClassifier.cs" />
<Compile Include="Commands\CommandClassifierProvider.cs" />
<Compile Include="Commands\PredefinedInteractiveCommandsContentTypes.cs" />
<Compile Include="Commands\InteractiveWindowCommandExtensions.cs" />
<Compile Include="Commands\InteractiveWindowCommands.cs" />
<Compile Include="Commands\HelpCommand.cs" />
......@@ -107,7 +106,7 @@
<Compile Include="CustomTrackingSpan.cs" />
<Compile Include="ExecutionResult.cs" />
<Compile Include="History.cs" />
<Compile Include="ContentTypeMetadata.cs" />
<Compile Include="IContentTypeMetadata.cs" />
<Compile Include="Commands\IInteractiveWindowCommands.cs" />
<Compile Include="Commands\IInteractiveWindowCommandsFactory.cs" />
<Compile Include="IInteractiveEvaluator.cs" />
......@@ -115,9 +114,8 @@
<Compile Include="IInteractiveWindowEditorFactoryService.cs" />
<Compile Include="IInteractiveWindowFactoryService.cs" />
<Compile Include="Commands\InteractiveCommandsFactory.cs" />
<Compile Include="IInteractiveWindowOperations.cs" />
<Compile Include="PredefinedInteractiveContentTypes.cs" />
<Compile Include="InteractiveContentTypeDefinitions.cs" />
<Compile Include="InteractiveConstants.cs" />
<Compile Include="InteractiveContentTypeNames.cs" />
<Compile Include="InteractiveWindow.cs" />
<Compile Include="InteractiveWindowExtensions.cs" />
<Compile Include="InteractiveWindowOptions.cs" />
......@@ -134,10 +132,10 @@
<Compile Include="Output\ResizingAdorner.cs" />
<Compile Include="Output\SortedSpans.cs" />
<Compile Include="Output\ZoomableInlineAdornment.cs" />
<Compile Include="PredefinedInteractiveTextViewRoles.cs" />
<Compile Include="PromptLineMapping.cs" />
<Compile Include="ReplInput.cs" />
<Compile Include="ReplSpanKind.cs" />
<Compile Include="RestoreHistoryEditTag.cs" />
<Compile Include="SmartIndent\InteractiveSmartIndenter.cs" />
<Compile Include="SmartIndent\InteractiveSmartIndenterProvider.cs" />
<Compile Include="SmartUpDownOption.cs" />
......@@ -159,4 +157,4 @@
<Import Project="..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -12,7 +12,7 @@ namespace Roslyn.Editor.InteractiveWindow
{
[Export(typeof(IViewTaggerProvider))]
[TagType(typeof(IntraTextAdornmentTag))]
[ContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName)]
[ContentType(InteractiveContentTypeNames.InteractiveContentType)]
internal sealed class InlineAdornmentProvider : IViewTaggerProvider
{
public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where T : ITag
......
......@@ -15,7 +15,7 @@ namespace Roslyn.Editor.InteractiveWindow
/// Classifies error text in interactive window output.
/// </summary>
[Export(typeof(IClassifierProvider))]
[ContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName)]
[ContentType(InteractiveContentTypeNames.InteractiveOutputContentType)]
[TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class OutputClassifierProvider : IClassifierProvider
{
......
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
namespace Roslyn.Editor.InteractiveWindow
{
public static class PredefinedInteractiveContentTypes
{
public const string InteractiveContentTypeName = "Interactive Content";
public const string InteractiveOutputContentTypeName = "Interactive Output";
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ internal sealed class InteractiveSmartIndenter : ISmartIndent
private readonly ISmartIndent indenter;
internal static InteractiveSmartIndenter Create(
IEnumerable<Lazy<ISmartIndentProvider, ContentTypeMetadata>> smartIndenterProviders,
IEnumerable<Lazy<ISmartIndentProvider, IContentTypeMetadata>> smartIndenterProviders,
IContentType contentType,
ITextView view)
{
......@@ -55,8 +55,8 @@ public void Dispose()
// If there are two providers that support the same content type, or
// two providers that support different content types that do not have
// inheritance relationship, we simply return the first we encounter.
private static Tuple<IContentType, Lazy<ISmartIndentProvider, ContentTypeMetadata>> GetProvider(
IEnumerable<Lazy<ISmartIndentProvider, ContentTypeMetadata>> smartIndenterProviders,
private static Tuple<IContentType, Lazy<ISmartIndentProvider, IContentTypeMetadata>> GetProvider(
IEnumerable<Lazy<ISmartIndentProvider, IContentTypeMetadata>> smartIndenterProviders,
IContentType contentType)
{
// If there are two providers that both support the
......@@ -67,7 +67,7 @@ public void Dispose()
return Tuple.Create(contentType, provider);
}
Tuple<IContentType, Lazy<ISmartIndentProvider, ContentTypeMetadata>> bestPair = null;
Tuple<IContentType, Lazy<ISmartIndentProvider, IContentTypeMetadata>> bestPair = null;
foreach (var baseType in contentType.BaseTypes)
{
var pair = GetProvider(smartIndenterProviders, baseType);
......
......@@ -7,16 +7,16 @@
namespace Roslyn.Editor.InteractiveWindow
{
[Export(typeof(ISmartIndentProvider))]
[ContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName)]
[ContentType(InteractiveContentTypeNames.InteractiveContentType)]
internal class InteractiveSmartIndenterProvider : ISmartIndentProvider
{
private readonly ITextEditorFactoryService editorFactory;
private readonly IEnumerable<Lazy<ISmartIndentProvider, ContentTypeMetadata>> indentProviders;
private readonly IEnumerable<Lazy<ISmartIndentProvider, IContentTypeMetadata>> indentProviders;
[ImportingConstructor]
public InteractiveSmartIndenterProvider(
ITextEditorFactoryService editorFactory,
[ImportMany] IEnumerable<Lazy<ISmartIndentProvider, ContentTypeMetadata>> indentProviders)
[ImportMany] IEnumerable<Lazy<ISmartIndentProvider, IContentTypeMetadata>> indentProviders)
{
if (editorFactory == null)
{
......
......@@ -2,7 +2,7 @@
namespace Roslyn.VisualStudio.InteractiveWindow
{
internal enum CommandIds : uint
public enum CommandIds : uint
{
// TODO (crwilcox): should all of these be in the editoroperations?
SmartExecute = 0x103,
......
......@@ -4,7 +4,7 @@
namespace Roslyn.VisualStudio.InteractiveWindow
{
internal static class Guids
public static class Guids
{
// vsct guids:
// This GUID identifies the VsInteractiveWindow type. We need to pass it to VS in a string form.
......
......@@ -14,8 +14,11 @@
<ProjectGuid>{20BB6FAC-44D2-4D76-ABFE-0C1E163A1A4F}</ProjectGuid>
<OutputType>Library</OutputType>
<UseCodebase>true</UseCodebase>
<!-- This project includes the VS SDK targets so we can produce a .pkgdef, but should not produce a .vsix or anything related to it -->
<CreateVsixContainer>false</CreateVsixContainer>
<DeployExtension>false</DeployExtension>
<RootNamespace>Microsoft.VisualStudio</RootNamespace>
<AssemblyName>Microsoft.VisualStudio.VsInteractiveWindow</AssemblyName>
<AssemblyName>Roslyn.VisualStudio.InteractiveWindow</AssemblyName>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
......@@ -73,7 +76,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CommandIds.cs" />
<Compile Include="ContentTypeMetadata.cs" />
<Compile Include="Guids.cs" />
<Compile Include="IVsInteractiveWindowEditorsFactoryService.cs" />
<Compile Include="VsInteractiveWindowEditorFactoryService.cs" />
......@@ -92,9 +94,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>VSInteractiveWindowResources.resx</DependentUpon>
</Compile>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VSInteractiveWindowResources.resx">
......@@ -123,4 +122,4 @@
<Import Project="..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -158,7 +158,7 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
switch ((CommandIds)nCmdID)
{
case CommandIds.BreakLine:
if (_window.Operations.BreakLine())
if (_window.BreakLine())
{
return VSConstants.S_OK;
}
......@@ -170,7 +170,7 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
switch ((VSConstants.VSStd2KCmdID)nCmdID)
{
case VSConstants.VSStd2KCmdID.RETURN:
if (_window.Operations.Return())
if (_window.Return())
{
return VSConstants.S_OK;
}
......@@ -182,7 +182,7 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
// break;
case VSConstants.VSStd2KCmdID.BACKSPACE:
if (_window.Operations.Backspace())
if (_window.Backspace())
{
return VSConstants.S_OK;
}
......@@ -193,7 +193,7 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
if (_window.CurrentLanguageBuffer != null && !_window.IsRunning && CaretAtEnd && UseSmartUpDown)
{
_window.Operations.HistoryPrevious();
_window.HistoryPrevious();
return VSConstants.S_OK;
}
break;
......@@ -201,7 +201,7 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
case VSConstants.VSStd2KCmdID.DOWN:
if (_window.CurrentLanguageBuffer != null && !_window.IsRunning && CaretAtEnd && UseSmartUpDown)
{
_window.Operations.HistoryNext();
_window.HistoryNext();
return VSConstants.S_OK;
}
break;
......@@ -209,24 +209,24 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
case VSConstants.VSStd2KCmdID.CANCEL:
if (_window.TextView.Selection.IsEmpty)
{
_window.Operations.Cancel();
_window.Cancel();
}
break;
case VSConstants.VSStd2KCmdID.BOL:
_window.Operations.Home(false);
_window.Home(false);
return VSConstants.S_OK;
case VSConstants.VSStd2KCmdID.BOL_EXT:
_window.Operations.Home(true);
_window.Home(true);
return VSConstants.S_OK;
case VSConstants.VSStd2KCmdID.EOL:
_window.Operations.End(false);
_window.End(false);
return VSConstants.S_OK;
case VSConstants.VSStd2KCmdID.EOL_EXT:
_window.Operations.End(true);
_window.End(true);
return VSConstants.S_OK;
}
}
......@@ -236,22 +236,22 @@ private int PreEditorCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint
switch ((VSConstants.VSStd97CmdID)nCmdID)
{
case VSConstants.VSStd97CmdID.Paste:
_window.Operations.Paste();
_window.Paste();
return VSConstants.S_OK;
case VSConstants.VSStd97CmdID.Cut:
_window.Operations.Cut();
_window.Cut();
return VSConstants.S_OK;
case VSConstants.VSStd97CmdID.Delete:
if (_window.Operations.Delete())
if (_window.Delete())
{
return VSConstants.S_OK;
}
break;
case VSConstants.VSStd97CmdID.SelectAll:
_window.Operations.SelectAll();
_window.SelectAll();
return VSConstants.S_OK;
}
}
......@@ -301,15 +301,11 @@ private int PreLanguageCommandFilterQueryStatus(ref Guid pguidCmdGroup, uint cCm
}
}
if (nextTarget != null)
{
var result = nextTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
var result = nextTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
#if DUMP_COMMANDS
//DumpCmd("QS", result, ref pguidCmdGroup, prgCmds[0].cmdID, prgCmds[0].cmdf);
#endif
return result;
}
return VSConstants.E_FAIL;
return result;
}
private int PreLanguageCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
......@@ -321,16 +317,16 @@ private int PreLanguageCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, ui
switch ((CommandIds)nCmdID)
{
case CommandIds.AbortExecution: _window.AbortCommand(); return VSConstants.S_OK;
case CommandIds.Reset: _window.Operations.ResetAsync(); return VSConstants.S_OK;
case CommandIds.SmartExecute: _window.Operations.ExecuteInput(); return VSConstants.S_OK;
case CommandIds.HistoryNext: _window.Operations.HistoryNext(); return VSConstants.S_OK;
case CommandIds.HistoryPrevious: _window.Operations.HistoryPrevious(); return VSConstants.S_OK;
case CommandIds.ClearScreen: _window.Operations.ClearView(); return VSConstants.S_OK;
case CommandIds.Reset: _window.ResetAsync(); return VSConstants.S_OK;
case CommandIds.SmartExecute: _window.ExecuteInput(); return VSConstants.S_OK;
case CommandIds.HistoryNext: _window.HistoryNext(); return VSConstants.S_OK;
case CommandIds.HistoryPrevious: _window.HistoryPrevious(); return VSConstants.S_OK;
case CommandIds.ClearScreen: _window.ClearView(); return VSConstants.S_OK;
case CommandIds.SearchHistoryNext:
_window.Operations.HistorySearchNext();
_window.HistorySearchNext();
return VSConstants.S_OK;
case CommandIds.SearchHistoryPrevious:
_window.Operations.HistorySearchPrevious();
_window.HistorySearchPrevious();
return VSConstants.S_OK;
}
}
......@@ -339,11 +335,11 @@ private int PreLanguageCommandFilterExec(ref Guid pguidCmdGroup, uint nCmdID, ui
switch ((VSConstants.VSStd2KCmdID)nCmdID)
{
case VSConstants.VSStd2KCmdID.TYPECHAR:
_window.Operations.Delete();
_window.Delete();
break;
case VSConstants.VSStd2KCmdID.RETURN:
if (_window.Operations.TrySubmitStandardInput())
if (_window.TrySubmitStandardInput())
{
return VSConstants.S_OK;
}
......
......@@ -26,10 +26,10 @@ internal sealed class VsInteractiveWindowEditorFactoryService : IInteractiveWind
private readonly IOleServiceProvider _provider;
private readonly IVsEditorAdaptersFactoryService _adapterFactory;
private readonly IContentTypeRegistryService _contentTypeRegistry;
private readonly IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> _oleCommandTargetProviders;
private readonly IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, IContentTypeMetadata>> _oleCommandTargetProviders;
[ImportingConstructor]
public VsInteractiveWindowEditorFactoryService(IVsEditorAdaptersFactoryService adaptersFactory, IContentTypeRegistryService contentTypeRegistry, [ImportMany]IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders)
public VsInteractiveWindowEditorFactoryService(IVsEditorAdaptersFactoryService adaptersFactory, IContentTypeRegistryService contentTypeRegistry, [ImportMany]IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, IContentTypeMetadata>> oleCommandTargetProviders)
{
_adapterFactory = adaptersFactory;
_provider = (IOleServiceProvider)InteractiveWindowPackage.GetGlobalService(typeof(IOleServiceProvider));
......
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="1F42C6D0-F876-4AF0-8185-1BEB0A325BB2" Version="|%CurrentProject%;GetBuildVersion|" Language="en-US" Publisher="Microsoft" />
<DisplayName>VisualStudio Interactive Components</DisplayName>
<Description>Interactive components for Visual Studio.</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,]" />
<InstallationTarget Version="[14.0,]" Id="Microsoft.VisualStudio.VSWinDesktopExpress" />
<InstallationTarget Version="[14.0,]" Id="Microsoft.VisualStudio.VWDExpress" />
<InstallationTarget Version="[14.0,]" Id="Microsoft.VisualStudio.VSWinExpress" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.VisualStudio.InteractiveWindow.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.VisualStudio.VsInteractiveWindow.dll" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="Microsoft.VisualStudio.VsInteractiveWindow.pkgdef" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="BindingPath.pkgdef" />
</Assets>
</PackageManifest>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册