Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Handle multiple workspaces in a project #46

Closed
wants to merge 1 commit into from

Conversation

TimvdLippe
Copy link
Contributor

The plugin should now be able to handle multiple projects. It does so by keeping track of at most 10 workspaces at the same time. Every time a file is opened, the workspace is inserted or the file counter is incremented. When a file is closed, the workspace file counter is decremented.

If there are more than 10 workspaces, it will try to remove the first workspace that has no more files open and remove that workspace from the map.

When the linter or autocomplete functions are invoked, the corresponding linter/autcompleter of the editor is looked up and returned.

  • CHANGELOG.md has been updated

Fixes #6

if (this.editorService) {
this.editorService.dispose();
// TODO(timvdlippe): Expose as user setting?
if (this.workspaces.size == 10) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be >= 10 to guard against adding a workspace if not one was removed, but also one was added.

lintOnFly: true,
lint: (editor) => {
const project = this.getProjectPathFromEditor(editor);
return this.workspaces.get(project)[1].linter.lint(editor);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if project does not exist in this.workspaces?

selector: '.text.html, .source.js',
getSuggestions: (options) => {
const project = this.getProjectPathFromEditor(options.editor);
return this.workspaces.get(project)[1].autocompleter.getSuggestions(options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if project does not exist in this.workspaces?

deactivate() {
this.subscriptions.dispose();
this.subscriptions = null;
this.workspaces = new Map();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to clean up the linter, autocompleter and tooltipmanager or is this already sufficient? We could also add them to this.subscriptions when we create them inside updateWorkspaceMap

@TimvdLippe
Copy link
Contributor Author

@rictic will #69 replace this PR as well?

@rictic
Copy link
Contributor

rictic commented Dec 6, 2017

Yes, this should be handled at the atom-languageclient level if it isn't already.

@rictic rictic closed this Dec 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for multiple project directories
2 participants