Live-share: [VS Code] .gitignore files do not show in the File Explorer

Created on 1 Oct 2018  路  3Comments  路  Source: MicrosoftDocs/live-share

Logs.zip

Product and Version [VS/VSCode]: VSCode
OS Version [macOS/Windows]: macOS
Live Share Extension Version: 0.3.735
Target Platform or Language [e.g. Node.js]: MacOS for the language Go

Scenario:
Any files that are inside of .gitignore does not show in the file explorer on the left.

Steps to Reproduce:

  1. Have the host create a .gitignore file ignoring / hiding directories and files. Include a file with a valid public / exported Go method (with a documentation comment)
  2. Have the host create a new LiveShare session
  3. Have the participant open the LiveShare session
  4. Notice how none of the files that were in the .gitignore show in the explorer
  5. However, notice that if you have a valid Go object (example: a public method) and you try to use that public method in code, IntelliSense successfully identifies it and gives you full method comment and parameter info for that method that exists in the hidden file.

Most helpful comment

@jpopadak, this is by design: any files matched by .gitignore are automatically _hidden_ from the guest file tree. As you point out, code and language services may still reference the hidden files. And guests can even open hidden files by means other than the file explorer, such as following the host, go-to-definition, step-into in a debugging session, find text results, or go-to-file.

If you want to change this behavior, you can add a .vsls.json file to the project and specify a value for the "gitignore" setting:

  • none - .gitignore contents are visible to guests in the file tree (assuming they are not filtered by a guest editor setting).
  • hide - The default. Globs inside .gitignore are hidden from the guest file tree but accessible to guests in other ways.
  • exclude - Globs inside .gitignore cannot be accessed by guests in any way.

For more details refer to the reference doc: https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/security#controlling-file-access-and-visibility

All 3 comments

@jpopadak, this is by design: any files matched by .gitignore are automatically _hidden_ from the guest file tree. As you point out, code and language services may still reference the hidden files. And guests can even open hidden files by means other than the file explorer, such as following the host, go-to-definition, step-into in a debugging session, find text results, or go-to-file.

If you want to change this behavior, you can add a .vsls.json file to the project and specify a value for the "gitignore" setting:

  • none - .gitignore contents are visible to guests in the file tree (assuming they are not filtered by a guest editor setting).
  • hide - The default. Globs inside .gitignore are hidden from the guest file tree but accessible to guests in other ways.
  • exclude - Globs inside .gitignore cannot be accessed by guests in any way.

For more details refer to the reference doc: https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/security#controlling-file-access-and-visibility

Thank you for this information, very detailed.

I looked through the documentation, but I apparently missed this entire section...

Thanks again!

@jpopadak Does this always require its own JSON file to configure? There's roughly 30 settings for live share that can be modified directly in VS Code's own settings file(s).

Was this page helpful?
0 / 5 - 0 ratings