public static OptionSet GetOptions(OmnisharpWorkspace workspace, OmniSharp.Options.FormattingOptions formattingOptions)
 {
     return workspace.Options
         .WithChangedOption(Microsoft.CodeAnalysis.Formatting.FormattingOptions.NewLine, LanguageNames.CSharp, formattingOptions.NewLine)
         .WithChangedOption(Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs, LanguageNames.CSharp, formattingOptions.UseTabs)
         .WithChangedOption(Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize, LanguageNames.CSharp, formattingOptions.TabSize)
         .WithChangedOption(Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentationSize, LanguageNames.CSharp, formattingOptions.IndentationSize);
 }
Example #2
0
        /// <summary>
        /// Builds the package.
        /// </summary>
        /// <returns></returns>
        private static async ValueTask BuildPackageAsync()
        {
            //Clone repo
            Console.WriteLine(Strings.CloningTheRepo);
            await GitProcessAsync(await Git.GetCloneStringAsync(PackageVersion).ConfigureAwait(false)).ConfigureAwait(false);

            //Instal dependencies
            Console.WriteLine(Strings.InstallingNpmDependencies);
            await NpmProcessAsync(Npm.Install, OmniSharp.OmniSharpDirectoryPath).ConfigureAwait(false);

            //Comment string if packaging on windows
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Console.WriteLine(Strings.CommentingThrowStatement);
                await
                CommentThrowStatementAsync(await OmniSharp.GetOfflinePackagingTasksPathAsync.ConfigureAwait(false),
                                           OmniSharp.StringToComment).ConfigureAwait(false);
            }

            //Compile package
            Console.WriteLine(Strings.CompilingThePackage);
            await NpmProcessAsync(Npm.Compile, OmniSharp.OmniSharpDirectoryPath).ConfigureAwait(false);

            //Create package
            Console.WriteLine(Strings.CreatingThePackage);
            await NpmProcessAsync(Npm.Gulp, OmniSharp.OmniSharpDirectoryPath).ConfigureAwait(false);

            //Move ready packages if necessary

            if (OutputDirectoryInfo == null)
            {
                return;
            }

            Console.WriteLine(Strings.MovingReadyPackages);

            //Windows
            File.Move(Path.Combine(OmniSharp.OmniSharpDirectoryPath,
                                   await OmniSharp.GetWindowsPackageNameAsync(PackageVersion).ConfigureAwait(false)),
                      Path.Combine(OutputDirectoryInfo.FullName,
                                   await OmniSharp.GetWindowsPackageNameAsync(PackageVersion).ConfigureAwait(false)));

            //Linux
            File.Move(Path.Combine(OmniSharp.OmniSharpDirectoryPath,
                                   await OmniSharp.GetLinuxPackageNameAsync(PackageVersion).ConfigureAwait(false)),
                      Path.Combine(OutputDirectoryInfo.FullName,
                                   await OmniSharp.GetLinuxPackageNameAsync(PackageVersion).ConfigureAwait(false)));

            //OSX
            File.Move(Path.Combine(OmniSharp.OmniSharpDirectoryPath, await OmniSharp.GetMacOsPackageNameAsync(PackageVersion).ConfigureAwait(false)),
                      Path.Combine(OutputDirectoryInfo.FullName, await OmniSharp.GetMacOsPackageNameAsync(PackageVersion).ConfigureAwait(false)));
        }
 public void OnProjectChanged(OmniSharp.Models.DnxProject project)
 {
     DispatchService.GuiDispatch (() => UpdateProject (project));
 }
 public void DependenciesUpdated(OmniSharp.Dnx.Project project, DependenciesMessage message)
 {
     DispatchService.GuiDispatch (() => UpdateDependencies (project, message));
 }
 void UpdateProject(OmniSharp.Models.DnxProject project)
 {
     DnxProject matchedProject = FindProjectByProjectJsonFileName (project.Path);
     if (matchedProject != null) {
         matchedProject.Update (project);
     }
 }
 void UpdateDependencies(OmniSharp.Dnx.Project project, DependenciesMessage message)
 {
     DnxProject matchedProject = FindProjectByProjectJsonFileName (project.Path);
     if (matchedProject != null) {
         matchedProject.UpdateDependencies (message);
     }
 }
 public void ReportDiagnostics(OmniSharp.Dnx.Project project, DiagnosticsMessage[] messages)
 {
     if (builder != null) {
         builder.OnDiagnostics (messages);
         builder = null;
     }
 }
 public void Update(OmniSharp.Models.DnxProject project)
 {
     this.project = project;
     base.OnExecutionTargetsChanged ();
 }
 void EnsureCurrentFrameworkDefined(OmniSharp.Dnx.FrameworkProject frameworkProject)
 {
     if (CurrentFramework == null) {
         CurrentFramework = frameworkProject.Project.ProjectsByFramework.Keys.FirstOrDefault ();
     }
 }
        public void UpdateReferences(OmniSharp.Dnx.FrameworkProject frameworkProject)
        {
            EnsureCurrentFrameworkDefined (frameworkProject);

            List<string> fileReferences = frameworkProject.FileReferences.Keys.ToList ();
            savedFileReferences[frameworkProject.Framework] = fileReferences;

            List<string> projectReferences = frameworkProject.ProjectReferences.Keys.ToList ();
            savedProjectReferences[frameworkProject.Framework] = projectReferences;

            if (CurrentFramework != frameworkProject.Framework)
                return;

            try {
                addingReferences = true;
                RemoveExistingReferences ();
                UpdateReferences (fileReferences);
                UpdateProjectReferences (projectReferences);
            } finally {
                addingReferences = false;
            }
        }
        public void UpdateParseOptions(OmniSharp.Dnx.FrameworkProject frameworkProject, Microsoft.CodeAnalysis.ParseOptions options)
        {
            EnsureCurrentFrameworkDefined (frameworkProject);

            List<string> symbols = options.PreprocessorSymbolNames.ToList ();
            preprocessorSymbols[frameworkProject.Framework] = symbols;

            if (CurrentFramework != frameworkProject.Framework)
                return;

            UpdatePreprocessorSymbols (symbols);
        }