Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: should check type of folders #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Shane-XB-Qian wants to merge 1 commit into bash-lsp:main from Shane-XB-Qian:pr_folders_arrary

Conversation

Copy link
Contributor

@Shane-XB-Qian Shane-XB-Qian commented Oct 29, 2022

closes #516

@@ -63,8 +63,10 @@ export default class Linter {
folders: LSP.WorkspaceFolder[],
): Promise<ShellcheckResult> {
const args = ['--format=json1', '--external-sources', `--source-path=${this.cwd}`]
for (const folder of folders) {
args.push(`--source-path=${folder.name}`)
if (Array.isArray(folders)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In which case is folders not an array? What is it?

I'm asking as the type signature here explicitly says that it should always be an array of LSP.WorkspaceFolder

Copy link
Contributor Author

@Shane-XB-Qian Shane-XB-Qian Nov 15, 2022

Choose a reason for hiding this comment

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

according to rough looking to lsp specification,
looks it said It can be 'null' if the client supports workspace folders but none are configured.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@Shane-XB-Qian Shane-XB-Qian Nov 17, 2022

Choose a reason for hiding this comment

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

the problem looks was the previous statement before L92.

Copy link
Contributor Author

 const folders = this.clientCapabilities.workspace?.workspaceFolders
 ? await connection.workspace.getWorkspaceFolders()
 : []
 const lintDiagnostics = await this.linter.lint(change.document, folders || [])
  1. this.clientCapabilities.workspace?.workspaceFolders this got from initialize and that is true.
  2. however await connection.workspace.getWorkspaceFolders() looks send workspace/workspaceFolders to lsp client, but got {'id': 0, 'jsonrpc': '2.0', 'result': {}}
  3. so that folders looks was a {} ?! <--------- !!!

so the problem is:

  1. could it get from this.clientCapabilities.workspaceFolders when/if this.clientCapabilities.workspace?.workspaceFolders is true?
  2. should lsp client response with result: ........ something else or could be {}?
  3. anyway, {} perhaps that's the direct problem.

Copy link
Contributor Author

Shane-XB-Qian commented Nov 17, 2022
edited
Loading

and looks others lsp server, i saw they just get workspaces folders from clientCapabilities.workspaceFolders, did not send/get from lsp workspace/workspaceFolders method.

Copy link
Contributor Author

@skovhus that should be a bug (or un-impl feature) of lsp client, i've opened a pr to correct/impl that.
// see yegappan/lsp#114

// but this pr to bash lsp server, perhaps should be better merged too, since varied lsp client may send others type of folders var.

Copy link
Collaborator

skovhus commented Nov 25, 2022

but this pr to bash lsp server, perhaps should be better merged too, since varied lsp client may send others type of folders var.

We shouldn't extend the LSP server here to support faulty clients – we want to follow the LSP standard. But thanks for fixing yegappan/lsp#114

I'm closing this for now, but thanks for looking into it.

Shane-XB-Qian reacted with eyes emoji

@Shane-XB-Qian Shane-XB-Qian deleted the pr_folders_arrary branch November 25, 2022 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@skovhus skovhus skovhus left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

TypeError: folders is not iterable

AltStyle によって変換されたページ (->オリジナル) /