Bug 1790517 - Exclude build directories as part of `./mach ide vscode`. r=firefox-build-system-reviewers,ahochheiden

Differential Revision: https://phabricator.services.mozilla.com/D183706
This commit is contained in:
Logan Rosen 2023-10-12 09:31:45 +00:00
Родитель d548d9a37a
Коммит 9c6398d3ee
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -57,6 +57,11 @@ integration.
Ignore Files in Mercurial Repositories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
This is automatically done when running ``./mach ide vscode`` but may be
changed manually.
When using Mercurial in mozilla-central, VS Code will treat your build directories as ordinary directories by default, causing some undesirable behavior including long indexing times, Go to Definition will open files in the build directory instead of the source tree, and Search Files by Name will find duplicate files from the source tree and the build directory (note: when using Git, VS Code will not do this since it reads ``.gitignore``). You can follow these directions to have VS Code largely ignore your build directories:
#. Go to Preferences -> Settings
@ -66,7 +71,7 @@ When using Mercurial in mozilla-central, VS Code will treat your build directori
#. Repeat the step above for the "Files: Watcher Exclude" setting
#. Reload VS Code: the easiest way to do this is to quit and reopen it.
Despite excluding the build directories above, Go to Definition will still correctly open files that only appear in the build directory such as generated source code. See `Bug 1790517 <https://bugzilla.mozilla.org/show_bug.cgi?id=1790517>`_ for our effort to automatically exclude the build directories.
Despite excluding the build directories above, Go to Definition will still correctly open files that only appear in the build directory such as generated source code.
Recommended Preferences
~~~~~~~~~~~~~~~~~~~~~~~

Просмотреть файл

@ -150,6 +150,8 @@ def setup_vscode(command_context, interactive):
else:
new_settings = setup_clangd_rust_in_vscode(command_context)
relobjdir = mozpath.relpath(command_context.topobjdir, command_context.topsrcdir)
# Add file associations.
new_settings = {
**new_settings,
@ -163,6 +165,8 @@ def setup_vscode(command_context, interactive):
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": True,
},
"files.exclude": {"obj-*": True, relobjdir: True},
"files.watcherExclude": {"obj-*": True, relobjdir: True},
}
import difflib