Giter Site home page Giter Site logo

Comments (9)

JounQin avatar JounQin commented on May 28, 2024 1

I don't get your point neither, why didn't you post the issue to helix instead? That editor is out of our control?

from taplo.

JounQin avatar JounQin commented on May 28, 2024

Did you try this config option?

https://taplo.tamasfe.dev/configuration/file.html#schema

from taplo.

ndtoan96 avatar ndtoan96 commented on May 28, 2024

Did you try this config option?

https://taplo.tamasfe.dev/configuration/file.html#schema

My file does not have any schema. The point is formatting and basic toml syntax diagnosis (something like brackets not matching...) shouldn't need a schema.

from taplo.

JounQin avatar JounQin commented on May 28, 2024

Schema will be enabled with filename patterns by default. And why helix editor's behaviour should be related to taplo?

from taplo.

ndtoan96 avatar ndtoan96 commented on May 28, 2024

I still don't get your point. So, I will describe my use case in more detail.

I use helix to edit a random toml file. It has the below content:

[config_a]
name_1="value1"
name_2        =     4

helix does support taplo. I check it with Cargo.toml and it works fine. But for this random toml file, as you can guess from the content, it's just a random file with no schema, and I cannot perform formatting in helix (using :fmt command). However, I open the same file in VSCode with Even Better Toml extension installed, press Shift-Alt-F and I can format the file.

What's more, I intentionally create a syntax error like below

[config_a]
name_1="value1"
name_2        =
4

I open the file in helix, and there's no error message. I open the file in VSCode, and it says there's an error.

I hope now you can understand what I'm trying to say. Even both editors use the same taplo lsp, the helix one cannot work without a schema, while the VSCode still works without a schema. What is the difference? How can I make the helix one behaves like the VSCode one?

from taplo.

ndtoan96 avatar ndtoan96 commented on May 28, 2024

My gut told me this is an issue on taplo side.

From my understanding, in LSP, to do formatting, the editor sends a request along with the current code to the LSP server, and the server sends a response back with the formatted code. Since the LSP logic in helix is implemented generally for all languages (it does not have a toml plugin, it doesn't even have plugin system yet), I can't imagine helix fails to send the request for toml alone. Which means it's highly likely that the server side, taplo in this case, somehow refutes the request or fails to send the response.

from taplo.

JounQin avatar JounQin commented on May 28, 2024

It requires https://github.com/helix-editor/helix's contributors to debug in depth then.

As you found, it worked for VSCode extension, so you still need to reproduce without helix to approve that's something wrong with taplo's side.

The point is always: why it's taplo's issue instead of helix's, so if you can reproduce it with a failing test case, that would be great.

from taplo.

ndtoan96 avatar ndtoan96 commented on May 28, 2024

Found the problem. I got suggestion when looking into the nvim-lspconfig for taplo. For the lsp to work, we need to configure the lsp root. Both VSCode and NeoVim already set the root for taplo in their plugins. Meanwhile helix is just barebone without any config and it considers a git project as root. That's why a random file from a random place is ignored.

from taplo.

ndtoan96 avatar ndtoan96 commented on May 28, 2024

LSP root config issue.

For those who got the same problem, I was able to fix this by adding this config in languages.toml

[[language]]
name = "toml"
roots = ["."]

from taplo.

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.