Esempio n. 1
0
        internal static Configuration GetInstance()
        {
            Configuration configuration = WorkspaceFolder.LoadConfiguration();

            WorkspaceFolder.Initialize(configuration);
            return(configuration);
        }
Esempio n. 2
0
        internal static void UpdateWorkspaceFolder(string name)
        {
            string path = Path.GetFullPath(Path.Combine(workingDirectory, name));

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            WorkspaceFolder.SetApplicationPath(path);
            WorkspaceFolder.LoadConfiguration();
        }
Esempio n. 3
0
 private async Task OnWorkspaceOpening(object sende, EventArgs e)
 {
     if (_workspaceFoldersSupported && IsInitialized && !_sentInitialWorkspaceFolders && WorkspaceService.CurrentWorkspace != null)
     {
         _sentInitialWorkspaceFolders = true;
         // Send just this workspace folder. Assumption here is that the language client will be destroyed/recreated on
         // each workspace open
         var folder = new WorkspaceFolder {
             uri = new System.Uri(WorkspaceService.CurrentWorkspace.Location), name = WorkspaceService.CurrentWorkspace.GetName()
         };
         await InvokeDidChangeWorkspaceFoldersAsync(new WorkspaceFolder[] { folder }, new WorkspaceFolder[0]);
     }
 }
Esempio n. 4
0
 private void OnProjectRemoved(EnvDTE.Project project)
 {
     if (_workspaceFoldersSupported)
     {
         JoinableTaskContext.Factory.RunAsync(async() => {
             var pythonProject = project as PythonProjectNode;
             if (pythonProject != null)
             {
                 var folder = new WorkspaceFolder {
                     uri = new System.Uri(pythonProject.BaseURI.Directory), name = project.Name
                 };
                 await InvokeDidChangeWorkspaceFoldersAsync(new WorkspaceFolder[0], new WorkspaceFolder[] { folder });
             }
         });
     }
 }
        private bool ValidateAsFileName(ComboBox comboBox)
        {
            if (string.IsNullOrEmpty(comboBox.Text))
            {
                comboBox.Focus();
                return(false);
            }

            try
            {
                WorkspaceFolder.ValidateAsFileName(comboBox.Text);
                return(true);
            }
            catch (ApplicationException e)
            {
                MessageBox.Show(e.Message, "", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }
        }
Esempio n. 6
0
        private static WorkspaceModel RetrieveModelByFile(Application anApp, string aFileName)
        {
            Workspace activeWorkspace = (Workspace)anApp.ActiveWorkspace;

            if (activeWorkspace == null)
            {
                throw new Exception("Unable to reach the Workspace");
            }
            Stack stack = new Stack();

            stack.Push(activeWorkspace);
            ArrayList list = new ArrayList();

            while (stack.Count != 0)
            {
                WorkspaceFolder item = (WorkspaceFolder)stack.Pop();
                if (!list.Contains(item))
                {
                    list.Add(item);
                    foreach (WorkspaceElement element in item.Children)
                    {
                        switch (element.ClassKind)
                        {
                        case -1262200149:
                        {
                            WorkspaceDocument document = (WorkspaceDocument)element;
                            if (document.Filename.ToLower() == aFileName.ToLower())
                            {
                                return((WorkspaceModel)document);
                            }
                            break;
                        }

                        case 0x42b53a08:
                            stack.Push(element);
                            break;
                        }
                    }
                }
            }
            return(null);
        }
Esempio n. 7
0
 public void Remove(WorkspaceFolder workspaceFolder)
 {
     Remove(workspaceFolder.Uri);
 }
Esempio n. 8
0
 internal void Save()
 {
     WorkspaceFolder.Save(this);
 }
Esempio n. 9
0
 internal static void Save(object targetObject, string file)
 {
     WorkspaceFolder.SaveObject(targetObject, Path.Combine(workingDirectory, file), true);
 }
 public void Remove(WorkspaceFolder folder, params WorkspaceFolder[] workspaceFolders) => Remove(new[] { folder }.Concat(workspaceFolders));
 public void Add(WorkspaceFolder folder, params WorkspaceFolder[] workspaceFolders) => Add(new[] { folder }.Concat(workspaceFolders));
Esempio n. 12
0
 public WorkspaceFolderChange(WorkspaceFolderEvent @event, WorkspaceFolder folder)
 {
     Event  = @event;
     Folder = folder;
 }
 public static LanguageClientOptions WithWorkspaceFolder(this LanguageClientOptions options, WorkspaceFolder workspaceFolder)
 {
     options.Services.AddSingleton(workspaceFolder);
     return(options);
 }