Skip to content

support non project root language servers#11

Closed
UziTech wants to merge 1 commit into
atom-community:masterfrom
UziTech:pr/250
Closed

support non project root language servers#11
UziTech wants to merge 1 commit into
atom-community:masterfrom
UziTech:pr/250

Conversation

@UziTech

@UziTech UziTech commented Jul 22, 2020

Copy link
Copy Markdown
Member

@UziTech UziTech marked this pull request as draft July 22, 2020 21:19
@UziTech UziTech added the needs tests PR needs tests before merging label Dec 12, 2020
@aminya

aminya commented Jan 27, 2021

Copy link
Copy Markdown
Member

This branch is removed. Could you revive it?

@aminya

aminya commented May 5, 2021

Copy link
Copy Markdown
Member

@UziTech Could you rebase this? This is needed for flow-ide

https://github.com/steelbrain/flow-ide

Comment thread lib/server-manager.ts
Comment on lines -261 to -276
public determineProjectPath(textEditor: TextEditor): string | null {
const filePath = textEditor.getPath();
if (filePath == null) {
return null;
}
return this._normalizedProjectPaths.find((d) => filePath.startsWith(d)) || null;
}

public updateNormalizedProjectPaths(): void {
this._normalizedProjectPaths = atom.project.getDirectories().map((d) => this.normalizePath(d.getPath()));
}

public normalizePath(projectPath: string): string {
return !projectPath.endsWith(path.sep) ? path.join(projectPath, path.sep) : projectPath;
}

@aminya aminya May 5, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should just move this code to auto-languageclient (without modifying) so the user can override them. Maybe there is a better way to make this configurable instead of moving the methods

(filepath) => this.filterChangeWatchedFiles(filepath),
this.reportBusyWhile,
this.getServerName(),
(e) => this.determineProjectPath(e),

@aminya aminya May 5, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of all these, we can probably provide a method that is passed down to this._serverManager.

A property of AutoLanguageclient:

      public customDetermineProject: undefined | (textEditor: TextEditor) => string | null = undefined

If someone wants to use this, they should override it with a function. Later inside ServerManager.determineProject, we will check if this method is !== undefined, and if so we will use that instead.

@UziTech

UziTech commented May 5, 2021

Copy link
Copy Markdown
Member Author

I don't have this branch anymore. It would be easier for you to create a new PR that does this.

@UziTech UziTech closed this May 5, 2021
@aminya

aminya commented May 6, 2021

Copy link
Copy Markdown
Member

Yeah, I think it's easier to start over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs tests PR needs tests before merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants