public RenameHandler(ISolution solution, BufferParser bufferParser, OmniSharpConfiguration config)
 {
     _solution          = solution;
     _bufferParser      = bufferParser;
     _findUsagesHandler = new FindUsagesHandler(bufferParser, solution);
     _config            = config;
 }
Exemple #2
0
 public BuildCommandBuilder(
     ISolution solution,
     OmniSharpConfiguration config)
 {
     _solution = solution;
     _config   = config;
 }
 public AutoCompleteHandler(ISolution solution, BufferParser parser, Logger logger, OmniSharpConfiguration config)
 {
     _solution = solution;
     _parser   = parser;
     _logger   = logger;
     _config   = config;
 }
Exemple #4
0
        public async Task GetBuildCommand()
        {
            const string source = @"
using NUnit.Framework;
using Should;

namespace TestApp.Tests
{
    [TestFixture]
    public class Tests
    {
        [Test]
        public void S$$hould_be_true()
        {
            true.ShouldBeTrue();
        }
    }
}
";

            OmniSharpConfiguration config = new OmniSharpConfiguration()
            {
                MSBuildPath = new BuildPath()
                {
                    Path = "path\\to\\msbuild"
                }
            };

            var runTest = await GetBuildCommandAsync(source);

            Assert.NotNull(runTest.First().Text);
        }
 public BuildCommandBuilder(
     ISolution solution,
     OmniSharpConfiguration config,
     Logger logger)
 {
     _logger   = logger;
     _solution = solution;
     _config   = config;
 }
 public CompletionDataFactory(IProject project, string partialWord, bool instantiating, AutoCompleteRequest request, OmniSharpConfiguration config)
 {
     _project           = project;
     _partialWord       = partialWord;
     _instantiating     = instantiating;
     _wantDocumentation = request.WantDocumentationForEveryCompletionResult;
     _wantMethodHeader  = request.WantMethodHeader;
     _wantSnippet       = request.WantSnippet;
     _wantReturnType    = request.WantReturnType;
     _config            = config;
 }
Exemple #7
0
 public TestCommandFacts(ITestOutputHelper output, SharedOmniSharpHostFixture sharedOmniSharpHostFixture)
     : base(output, sharedOmniSharpHostFixture)
 {
     OmniSharpConfiguration config = new OmniSharpConfiguration();
     OmniSharpConfiguration omniSharpConfiguration = new OmniSharpConfiguration()
     {
         MSBuildPath = new BuildPath()
         {
             Path = "path\\to\\msbuild"
         }
     };
 }
Exemple #8
0
        private async Task <string> GetTestCommandAsync(string source, TestCommandType testType)
        {
            var testFile = new TestFile("dummy.cs", source);

            SharedOmniSharpTestHost.AddFilesToWorkspace(testFile);

            var rh = SharedOmniSharpTestHost.GetRequestHandler <TestCommandService>(OmniSharpEndpoints.TestCommand);
            OmniSharpConfiguration config = new OmniSharpConfiguration()
            {
                MSBuildPath = new BuildPath()
                {
                    Path = "path\\to\\source"
                },
                TestCommands = new TestCommands()
                {
                    All     = "nunit3-console.exe --noresult --noh {{AssemblyPath}}",
                    Single  = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}",
                    Fixture = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}"
                }
            };

            rh._config = config;
            var cc = rh._config;

            rh._testCommandProviders.First().testCommands = TestCommandType.All;

            var point          = testFile.Content.GetPointFromPosition();
            var requestHandler = GetRequestHandler(SharedOmniSharpTestHost);
            var request        = new TestCommandRequest
            {
                Type     = testType,
                Line     = point.Line,
                FileName = testFile.FileName,
                Buffer   = testFile.Content.Code
            };
            var response = await requestHandler.Handle(request);

            return(response.TestCommand);
        }
Exemple #9
0
        public async Task GetTestCommand_All_Test()
        {
            const string           source = @"
using NUnit.Framework;
using Should;

namespace TestApp.T$$ests
{
    [TestFixture]
    public class Tests
    {
        [Test]
        public void Should_be_true()
        {
            true.ShouldBeTrue();
        }
    }
}
";
            OmniSharpConfiguration config = new OmniSharpConfiguration()
            {
                MSBuildPath = new BuildPath()
                {
                    Path = "path\\to\\source"
                },
                TestCommands = new TestCommands()
                {
                    All     = "nunit3-console.exe --noresult --noh {{AssemblyPath}}",
                    Single  = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}",
                    Fixture = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}"
                }
            };

            var runTest = await GetTestCommandAsync(source, TestCommandType.All);

            Assert.NotNull(runTest);
            Assert.Contains("nunit3-console.exe --noresult --noh", runTest);
        }
Exemple #10
0
        public string GetDocumentation(IProject project, IEntity entity, OmniSharpConfiguration config)
        {
            string idString = entity.GetIdString();
            string result;

            if (_documentationCache.TryGetValue(idString, out result))
            {
                return(result);
            }

            DocumentationComment documentationComment = null;

            if (entity.Documentation != null)
            {
                // Documentation from source code
                documentationComment = entity.Documentation;
            }
            else
            {
                if (entity.ParentAssembly.AssemblyName != null)
                {
                    IDocumentationProvider docProvider =
                        XmlDocumentationProviderFactory.Get(project, entity.ParentAssembly.AssemblyName);

                    if (docProvider != null)
                    {
                        documentationComment = docProvider.GetDocumentation(entity);
                    }
                }
            }

            result = documentationComment != null
                ? DocumentationConverter.ConvertDocumentation(documentationComment.Xml.Text, config)
                : null;

            _documentationCache.TryAdd(idString, result);
            return(result);
        }
Exemple #11
0
 public CodeFormatHandler(OmniSharpConfiguration config)
 {
     _config = config;
 }
Exemple #12
0
 public CodeIssuesHandler(BufferParser bufferParser, OmniSharpConfiguration config)
 {
     _bufferParser      = bufferParser;
     _config            = config;
     _ignoredCodeIssues = ConfigurationLoader.Config.IgnoredCodeIssues;
 }
Exemple #13
0
 public OmniSharpScript(OmniSharpRefactoringContext context, OmniSharpConfiguration config)
     : base(context.Document, config.CSharpFormattingOptions, config.TextEditorOptions)
 {
     _context = context;
 }
Exemple #14
0
 public OverrideHandler(BufferParser parser, OmniSharpConfiguration config)
 {
     _parser = parser;
     _config = config;
 }
Exemple #15
0
 public FixUsingsHandler(BufferParser bufferParser, Logger logger, OmniSharpConfiguration config)
 {
     _bufferParser = bufferParser;
     _logger       = logger;
     _config       = config;
 }
Exemple #16
0
 public CodeIssuesHandler(BufferParser bufferParser, OmniSharpConfiguration config)
 {
     _bufferParser = bufferParser;
     _config       = config;
 }
Exemple #17
0
 public GetCodeActionsHandler(BufferParser bufferParser, OmniSharpConfiguration config)
 {
     _bufferParser = bufferParser;
     _config       = config;
 }
Exemple #18
0
        /// <summary>
        /// Converts the xml documentation string into a plain text string.
        /// </summary>
        public static string ConvertDocumentation(string xmlDocumentation, OmniSharpConfiguration config)
        {
            if (string.IsNullOrEmpty(xmlDocumentation))
            {
                return(string.Empty);
            }

            var reader = new System.IO.StringReader("<docroot>" + xmlDocumentation + "</docroot>");
            var xml    = new XmlTextReader(reader);
            var ret    = new StringBuilder();

            try
            {
                xml.Read();
                do
                {
                    if (xml.NodeType == XmlNodeType.Element)
                    {
                        string elname = xml.Name.ToLowerInvariant();
                        switch (elname)
                        {
                        case "filterpriority":
                            xml.Skip();
                            break;

                        case "remarks":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append("Remarks:");
                            ret.Append(config.TextEditorOptions.EolMarker);
                            break;

                        case "example":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append("Example:");
                            ret.Append(config.TextEditorOptions.EolMarker);
                            break;

                        case "exception":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append(GetCref(xml["cref"]));
                            ret.Append(": ");
                            break;

                        case "returns":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append("Returns: ");
                            break;

                        case "see":
                            ret.Append(GetCref(xml["cref"]));
                            ret.Append(xml["langword"]);
                            break;

                        case "seealso":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append("See also: ");
                            ret.Append(GetCref(xml["cref"]));
                            break;

                        case "paramref":
                            ret.Append(xml["name"]);
                            break;

                        case "param":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append(Whitespace.Replace(xml["name"].Trim(), " "));
                            ret.Append(": ");
                            break;

                        case "value":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            ret.Append("Value: ");
                            ret.Append(config.TextEditorOptions.EolMarker);
                            break;

                        case "br":
                        case "para":
                            ret.Append(config.TextEditorOptions.EolMarker);
                            break;
                        }
                    }
                    else if (xml.NodeType == XmlNodeType.Text)
                    {
                        ret.Append(Whitespace.Replace(xml.Value, " "));
                    }
                } while (xml.Read());
            }
            catch (Exception)
            {
                return(xmlDocumentation);
            }
            return(ret.ToString());
        }
Exemple #19
0
 public TypeLookupHandler(ISolution solution, BufferParser bufferParser, OmniSharpConfiguration config)
 {
     _config       = config;
     _bufferParser = bufferParser;
     _solution     = solution;
 }
Exemple #20
0
 public BuildCommandService(OmniSharpWorkspace workspace, IBuildProvider config)
 {
     _workspace = workspace;
     _config    = config.config;
 }