Skip to content
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

LSP cannot get completion info when file has using or await using declaration #23688

Closed
ben-laird opened this issue May 4, 2024 · 1 comment · Fixed by #23748
Closed

LSP cannot get completion info when file has using or await using declaration #23688

ben-laird opened this issue May 4, 2024 · 1 comment · Fixed by #23748
Assignees
Labels
bug Something isn't working

Comments

@ben-laird
Copy link

ben-laird commented May 4, 2024

Version: Deno 1.43.1

Hello! I'm using the new explicit resource management proposals in tests, and the language server returns an error whenever a using or await using declaration is made.

Error from VSCode:

Unable to get completion info from TypeScript: unknown variant `using`, expected one of ``, `warning`, `keyword`, `script`, `module`, `class`, `local class`, `interface`, `type`, `enum`, `enum member`, `var`, `local var`, `function`, `local function`, `method`, `getter`, `setter`, `property`, `constructor`, `call`, `index`, `construct`, `parameter`, `type parameter`, `primitive type`, `label`, `alias`, `const`, `let`, `directory`, `external module name`, `JSX attribute`, `string`, `link`, `link name`, `link text` at line 1 column 438

Minimal example:

Deno.test("LSP cannot load completions with using declarations", () => {
  function makeResource() {
    return {
      execute() {
        console.log("Stuff happens...");
      },

      [Symbol.dispose]() {
        console.log("All done!");
      },
    };
  }

  using resource = makeResource();

  resource.execute();
});

Requesting completions from the LSP in the code above will silently fail and will only succeed when automatically called; for example, completion fails when typing "resource" inside the test function, but completions load properly for "resource." (ie when trying to access a property). Tests still pass as expected, this seems to only be an LSP issue.

EDIT: Possibly a duplicate of #22392

@dsherret dsherret added the bug Something isn't working label May 4, 2024
@dsherret
Copy link
Member

dsherret commented May 4, 2024

Key point:

Requesting completions from the LSP in the code above will silently fail and will only succeed when automatically called; for example, completion fails when typing "resource" inside the test function, but completions load properly for "resource."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants