Giter VIP home page Giter VIP logo

Comments (5)

josevalim avatar josevalim commented on August 24, 2024

Thank you!

The message is not truncated, we don't include the snippet because we expect you to show it. I think however it can be confusing. Perhaps we should end the message by saying "typing violation found"?

We could compute the spam though, that would benefit both the console warning and the terminal one.

And what do you expect to be in detail?

from elixir.

lukaszsamson avatar lukaszsamson commented on August 24, 2024

we don't include the snippet because we expect you to show it

I don't think I follow. This is clearly different than TokenMissingError etc. where snippets are returned. I don't insist that the snippet is needed. Position/span is sufficient for LSP

And what do you expect to be in detail?

Other errors have exception in detail. I would expect to find some structured info about the type problem:

  • positions where conflicting types are defined
  • the conflicting types as data

In LSP Diagnostic besides the main position/span (range property) and message, there is a collection relatedInformation which can contain additional positions and messages. It's possible to build diagnostics that reference type definitions in another files. This is an example from elixir-ls
Screenshot 2024-06-06 at 22 02 39

from elixir.

josevalim avatar josevalim commented on August 24, 2024

This is clearly different than TokenMissingError etc. where snippets are returned. I don't insist that the snippet is needed.

I think that's rather a flaw in TokenMissingError. I don't think we include it anywhere else. If you do IO.warn("hello", __ENV__) in the module body, does the diagnostic have the snippet as well or not really?

Other errors have exception in detail. I would expect to find some structured info about the type problem:

Got it. I will see what we can expose. Perhaps we can expose the traces.

from elixir.

lukaszsamson avatar lukaszsamson commented on August 24, 2024

does the diagnostic have the snippet as well or not really?

No, only some of them do. The changes to include snippets were introduced in 1.16. In fact they do look ugly if the UI displaying it is not using a monospaced font (and there is no markdown support in diagnostic messages but that's VSCode issue microsoft/vscode#54272)

Screenshot 2024-06-09 at 08 09 42 Screenshot 2024-06-09 at 08 10 20 Screenshot 2024-06-09 at 08 11 03

from elixir.

josevalim avatar josevalim commented on August 24, 2024

For completeness, the reason why syntax error, token missing error, etc include the snippets is because they are exceptions. You can probably intercept those exceptions and render something without the snippets if desired.

from elixir.

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.