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

Format on save issue #9

Open
FrenchTechLead opened this issue Oct 1, 2020 · 7 comments
Open

Format on save issue #9

FrenchTechLead opened this issue Oct 1, 2020 · 7 comments
Labels
bug Something isn't working Hacktoberfest

Comments

@FrenchTechLead
Copy link
Owner

Current behaviour :

The .jvs code is getting formatted on save regardless of the value of robusta.formatOnSave property.

Expected behaviour:

  • The .jvs code should not get formatted if the property robusta.formatOnSave is set to false.
  • If robusta.formatOnSave is set to true and robusta.compileOnSave is also set to true : make sure to let finish the formatting task before running the compiling task.
@FrenchTechLead FrenchTechLead added bug Something isn't working Hacktoberfest labels Oct 1, 2020
@manekinekko
Copy link
Contributor

I am working on this!

@FrenchTechLead
Copy link
Owner Author

You rock man !

@manekinekko
Copy link
Contributor

After investigating this, it seems that your code is working as expected.

I tried your extension locally, and I can format (or not) the .jvs file based on the value of robusta.formatOnSave. Same thing for compiling.

Did I miss something?

@FrenchTechLead
Copy link
Owner Author

After investigating this, it seems that your code is working as expected.

I tried your extension locally, and I can format (or not) the .jvs file based on the value of robusta.formatOnSave. Same thing for compiling.

Did I miss something?

I think the problem occurs when the property editor.formatOnSave is set to true, in this case the RobustaFormatingProvider is called even if robusta.formatOnSave is set to false. because RobustaFormatingProvider is registered as a formatting provider to vscode.

@manekinekko
Copy link
Contributor

Oh! Gotcha! I can reproduce the issue when setting editor.formatOnSave to true. I will investigate this issue.

@manekinekko
Copy link
Contributor

I did some researches and it seems that the best options is to remove the robusta.formatOnSave option and use editor.formatOnSave like so:

// Set the default
"editor.formatOnSave": false,

// Enable per-language
"[jvs]": {
    "editor.formatOnSave": true
}

Also, your current implementation of the formatter is the correct approach, according to the documentation.

@FrenchTechLead
Copy link
Owner Author

I did some researches and it seems that the best options is to remove the robusta.formatOnSave option and use editor.formatOnSave like so:

// Set the default
"editor.formatOnSave": false,

// Enable per-language
"[jvs]": {
    "editor.formatOnSave": true
}

Also, your current implementation of the formatter is the correct approach, according to the documentation.

You're right, that seems to be the issue here, I think we should move the robusta.formatOnSave and the corresponding action as well, to let the formatting provider do the the job by it self.

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

No branches or pull requests

2 participants