Skip to content

Git ignore local-user-specific VSCode settings#78

Closed
bravo-kernel wants to merge 1 commit intoPoshCode:masterfrom
bravo-kernel:vscode-settings
Closed

Git ignore local-user-specific VSCode settings#78
bravo-kernel wants to merge 1 commit intoPoshCode:masterfrom
bravo-kernel:vscode-settings

Conversation

@bravo-kernel
Copy link
Copy Markdown
Contributor

  • ignore .vscode/settings.json as these contain local-user settings (and should not be in the repo)
  • keep monitoring the vscode project files

@bravo-kernel bravo-kernel changed the title Git ignore user-based VSCode settings Git ignore local-user-specific VSCode settings Oct 13, 2019
@scrthq
Copy link
Copy Markdown

scrthq commented Oct 18, 2019

The settings in that settings file are there to enforce code style across the project though, not some random personal user settings.

@bravo-kernel
Copy link
Copy Markdown
Contributor Author

@scrthq the single file that I am excluding here (settings.json) is exclusively meant for personal settings, tied to the local users machine. For example, my window colors preferences are there. Code consistency is enforced through .editorconfig and .gitattributes.

@gaelcolas
Copy link
Copy Markdown
Contributor

Editor config does not let you set the PSScript Analyzed custom rules, right?

@bravo-kernel
Copy link
Copy Markdown
Contributor Author

bravo-kernel commented Oct 18, 2019

The point is that the settings enforced in settings.json are enforced to all my local files, not just this repository since these settings are not repository-bound.

  • imagine that I prefer hard tabs instead of spaces in an other powershell repo
  • git status shows the file as changed even though I don't want to commit/push it
  • also, if rules are to be enforced in a strict manner, depending on .vscode is no guarantee for that, any editor could be used, better to enforce in e.g. CI

This is not my own idea either btw, most large repos follow this solution, all to smoothen the contribution process, something I hope we can accomplish here as well, see the template PR.

Hope this clarifies things.

ps: I totally agree that better Powershell enforcement is needed in general BTW. Especially when comparing with the tooling that is out there for js, php and all others (take prettier for example). Powershell feels a little left behind in this field.

@ChrisLGardner
Copy link
Copy Markdown

There's 2 settings.json files, one at the user level in ~/.vscode and the other in the root of the repo. The ones in the repo enforce settings just within that repo, the ones in the user level are for every repo (and overridden by more specific ones).

@bravo-kernel
Copy link
Copy Markdown
Contributor Author

@ChrisLGardner it looks like you are correct, strikethrough applied above. The other points are still valid IMO. Here's my settings.json giving me the git status headache.

{
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "powershell.codeFormatting.preset": "OTBS",
    "powershell.codeFormatting.ignoreOneLineBlock": false,
    "powershell.codeFormatting.newLineAfterCloseBrace": false,
    "files.associations": {
        "*.ps1xml": "xml"
    },
    "workbench.colorCustomizations": {
        "activityBar.background": "#0A342F",
        "titleBar.activeBackground": "#0F4841",
        "titleBar.activeForeground": "#F3FDFC"
    }
}

ps: good to see so much feedback, means eyes are on this place

@ChrisLGardner
Copy link
Copy Markdown

If you want to change the local repo copy of the settings.json but don't want to commit it then you can use git update-index --assume-unchange .vscode/settings.json and it'll ignore all changes to that file for you.

@bravo-kernel
Copy link
Copy Markdown
Contributor Author

Yes, of course that will also do the job and by reading the feedback I now think it might actually the best solution for this repo, you folks seems adequate enough to handle this as you see fit. Thus closing this PR.

I was thinking from the end-user perspective but those will most likely only be focussed on/using the files produced by the template which can have their own settings.

ps: if I could get feedback on #77 that would be highly appreciated. I am releasing a module that references ModuleBuilder soon and think it would be awesome if the template would be available then.

@bravo-kernel bravo-kernel deleted the vscode-settings branch October 18, 2019 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants