vs-shell-format icon indicating copy to clipboard operation
vs-shell-format copied to clipboard

"shellformat.flag" does not work at the project level in a multi-root workspace

Open ggiamarchi opened this issue 4 years ago • 4 comments

In my project's folder, I have a .vscode/settings.json containing

{
    "shellformat.flag": "-sr",
    "editor.tabSize": 4,
    "editor.detectIndentation": true,
    "editor.renderWhitespace": "all",
    "editor.formatOnSave": true,
}

When I add my folder in a newly created workspace everything goes well. When I had more folders into the workspace, properties shellformat.* at the project level are not taken into account anymore.

I get a message saying

This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly.

ggiamarchi avatar Jan 21 '20 11:01 ggiamarchi

Thank you for reporting!

you should put settings on workspace config file for workspace .

// xxx.code-workspace

{
  "folders": [
	{
		"path": "f1"
	},
	{
		"path": "f2"
	}
],
  "settings": {
    "shellformat.flag": "-sr",
    "editor.tabSize": 4
  }
}

test.tar.gz

code test.code-workspace for test

foxundermoon avatar Jan 21 '20 16:01 foxundermoon

Yes, I forgot to tell it, I managed to make it work using the workspace settings.

Does the wrong usage label mean you don't consider this behavior as a bug? If yes, there's probably something I did not understand. Is there a reason to not handle settings at the folder level but only at the workspace level?

ggiamarchi avatar Jan 21 '20 16:01 ggiamarchi

i also did not understand the vscode workspace setting mechanism. i want know other plugin behavior. if there is a different behavior, it's maybe a bug.

I Can't confirm if it's a bug now.

foxundermoon avatar Jan 21 '20 17:01 foxundermoon

I believe other plugins like shellcheck let you apply individual project settings even within a workspace. The shfmt.flag setting is greyed out within my project folder; however the shellcheck options appear to remain active.

If possible, it would be nice to have the choice to choose whether or not we want shfmt applied to a single project or the entire workspace and not have to choose every project in the workspace or nothing at all.

liaralabs avatar Dec 08 '20 19:12 liaralabs