Code Monkey home page Code Monkey logo

Comments (6)

predragnikolic avatar predragnikolic commented on September 22, 2024

Please provide steps to reproduce the issue.

from typescript-language-server.

rchl avatar rchl commented on September 22, 2024

And what would you expect the type of foo (const foo) be if not a variable?

from typescript-language-server.

babyccino avatar babyccino commented on September 22, 2024

I don't see why it wouldn't be CompletionItemKind 21 "Constant", that makes the most sense

from typescript-language-server.

rchl avatar rchl commented on September 22, 2024

Server tries to match this VSCode code: https://github.com/microsoft/vscode/blob/428dd56479f4f9987fe0b0a444c11c46e84b2525/extensions/typescript-language-features/src/languageFeatures/completions.ts#L440-L499

As you see both here and there, the Constant is used for string literal.

Constant wouldn't really be more correct as const foo is still a variable, just of a const type. You can't satisfy everyone since it's only possible to describe the completion with a single type. And I would argue that it's more useful to see that the completion is a variable than that it has constant type.

from typescript-language-server.

babyccino avatar babyccino commented on September 22, 2024

I figured that was the reason, I think the completion item kind interface also more closesly matches with TypeScript's type rather than class but I understand you're trying to just match with VsCode as much as possible.

The other LSPs I've worked with (rust-analyzer, gopls) give a function signature or variable type in the item details as well as the import. Is there any appetite to have typescript-language-server function in the same way? I'm not familiar with the VsCode codebase but their completions do give the correct kind for types, const, let, etc. I'd be happy to implement this if so

from typescript-language-server.

rchl avatar rchl commented on September 22, 2024

I'm not familiar with the VsCode codebase but their completions do give the correct kind for types, const, let, etc. I'd be happy to implement this if so

What do you mean by that. I've said above that this project tries to match VSCode implementation so if it's not matching it then that would be a "bug".

from typescript-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.