Why is Find in Files in Visual Studio Code OSX ignoring my search.excludeFolders setting? - search

Even with the default configuration, I still get tons of results in various node_modules folders when doing a workspace search.
Default setting:
"search.excludeFolders": [
".git",
"node_modules",
"bower_components"
],
I've even tried copying to my user settings and changing to several variants, such as "/node_modules", "/node_modules/", etc.
I've already seen the other post in vscode about this issue: How can I choose folders to be ignored during search? . This answer doesn't solve my issue.
I'm using Version 0.1.0 on OS X (commit d13afe1). Any chance there's a bug with exclude folders?

After reading again your question and trying it out, only now I notice that the search.excludeFolders values apply only to the workspace root. So, for a node_modules folder in your hierarchy, you would need to use:
{
"search.excludeFolders": [
".git",
"node_modules",
"bower_components",
"path/to/node_modules"
]
}

These preferences appear to have changed since #alex-dima's answer.
App -> Preferences -> User/Workspace Settings
You can choose custom settings that will apply to searches. For example, I am developing an EmberJS application which saves thousands of files under the tmp directory.
Picture of search before updating settings.
After updating the Visual Studio settings.
{
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true
}
}
Note: Include a ** at the beginning of any search exclusion to cover the search term over any folders and sub-folders.
The search results are exactly what I want.
Picture of search after updating settings.

Related

Disable specific Pylance linting messages in VS Code settings.json like with "python.linting.pylintArgs"

When Pylance was introduced, I filed a question on how to generally customize Pylance linting. Here, one can find a few ways to customize Pylance, but there is nothing about how to suppress, mute or actually disable certain warnings and errors.
As a recap, with pylint one can specify the following in VS Code settings.json to disable a certain error/warning:
"python.linting.pylintArgs": [
"--disable=C0111"
]
As for the background, since the excessive Pylance(reportMissingImports) linting errors has not been resolved yet and due to project requirements, I've enabled pylint simultaneously with Pylance. Still, these countless Pylance(reportMissingImports) linting errors are annoying and I'd like to silence them completely.
Find the error-message you want to modify/disable in the Pylance's Diagnostic Severity Rules (in my case "reportMissingImports")
Modify settings.json with "reportMissingImports": "none" (see diagnosis reporting levels in Pylance's Settings and Customization)
The entire JSON-code to be inserted into the settings.json is:
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingImports": "none"
}
As an aside, if you want to be at least informed about unused imports, you can use:
"python.analysis.diagnosticSeverityOverrides": {
"reportUnusedImport": "information",
"reportMissingImports": "none"
}
PS: regarding the settings.json - location
Along with the global settings.json there are also local versions in your VS-Code-projects' parent directories. In the following, example paths are provided based on my Windows 10 - OS:
global: C:\Users\user.name\AppData\Roaming\Code\User\settings.json
local: .vscode/settings.json
These local project settings override the global ones, if desired.

Double Filetype Extension: Correct Syntax Highlighting in Sublime Text 3

I am working with some .scss.liquid files and they always open as HTML Liquid, no matter how many times I set the syntax.
Update:
I tried open all with current extension as option, but unfortunately this affects files that are .js.liquid and .html.liquid as well.
Sublime Text allows you to apply settings on a per-language basis (actually, per syntax). One of the available settings allows you to map file extensions to the given syntax.
Assuming you're using a syntax named SCSS, Create an SCSS settings file in your User settings: /path/to/packages/User/SCSS.sublime-settings, then add the file extension setting:
{
"extensions":
[
"scss.liquid"
]
}
As you can see, it's a json file, and extensions is a list, so you can add as many file extensions as you need. Do not add the leading dot.
Caveat about the file name
The file name for the settings file must match the actual syntax name, including case. In this case it has to be SCSS.sublime-settings. Other examples include:
NAnt Build File.sublime-settings
Ruby on Rails.sublime-settings
Rd (R Documentation).sublime-settings
Java Server Page (JSP).sublime-settings
I found a relatively straightforward solution to this problem.
Install ApplySyntax
Create the following rules in ApplySyntax.sublime-settings -- User:
"syntaxes": [
{
"syntax": "SCSS",
"extensions": ["scss.liquid"]
},
{
"syntax": "JavaScript/JavaScript",
"extensions": ["js.liquid"]
},
]
Update: I now see there is no need for an extra package. Please see accepted answer and my video (in the comments) for tips on how to make it work.

Sublime text 3 and overriding settings per project doesn't work

I've setup to my user settings on sublime text 3, the following option: trim_trailing_white_space_on_save: true
But it seems our collagues have a different opinion regarding of it and if it is useful. So I have to override this setting per project (I wanted to other projects, I just want to be skipped on a specific one). I've tried by creating a file .sublime-workplace and/or .sublime-project on the root of the project folder and I added the following:
{
"settings":
{
"trim_trailing_white_space_on_save": false
}
}
But when I save a file with whitespaces, it still keeps trimming them. What am I doing wrong? Is there specific settings which I can bypass per-project? If yes, is there another way of doing that (maybe a sublime plugin or something).
From the description in your question, the problem may be that you created the project file but didn't actually open it. Sublime only treats paths with a project file in them specially if you open the project, e.g. via Project > Open Project or from the command line via subl --project path/to/project.sublime-project.
Additionally, without a list of paths to include in the project, the project defaults itself to being empty, which is probably not what you want.
From your existing window that you're already working with, select Project > Save Project As... to save a project and workspace that captures the current state of everything; folders visible in the side bar as well as any files that may already be open. Once that's done you can use Project > Edit Project to edit the project file and add the setting as you did above.
Aside from that, a project file like the following saved into the folder you're using for your project will also do what you want; just remember to use Project > Open Project... or Project > Switch Project... to open the file you've created so that Sublime will use it.
{
"folders":
[
{
"path": "."
}
],
"settings":
{
"trim_trailing_white_space_on_save": true
}
}

SublimeText 3 using 100% CPU, "stuck while processing file"

I've been using Sublime Text 3 for some time now, and over the past few weeks I've run into an issue where Sublime will spawn numerous processes, eating up 100% of my CPU.
Below is the output of wmic process where "name='sublime_text.exe'"
CommandLine ProcessId
"C:\Program Files\Sublime Text 3\sublime_text.exe" 10980
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:1" 12152
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:1" 8420
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:3" 6016
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:3" 12008
When I open Sublimes console, I see the following lines
worker 8420 appears stuck while processing file /D/dev/project/ext/index.html, killing process
worker 8420 appears stuck while processing file /D/dev/project/ext/build/index.html, killing process
I've since removed the entire /D/dev/project/ext folder from the index, and then I removed it from the project entirey, but that didn't seem to help.
Has anyone seen this before? I'd really rather not do a full re-install of Sublime.
You can try this:
shift + super + p:
{
"color_scheme": "Packages/User/SublimeLinter/Monokai Bright (SL).tmTheme",
"font_size": 13,
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules/*"],
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
}
references:
Limit File Search Scope in Sublime Text 2
It may be the case that you have opened a project which contains 3rd party libraries.
In my particular case I have this kind of problem if I do not exclude from Project Index node_modules directory of some bigger node.js application.
Sublime Text tries to refresh index files on each run.
Add exclude pattern in your Project:
"folder_exclude_patterns":
[
"DIR_NAME"
]
I have had this question come up several times so I'd like to give a more complete answer.
What are they and how do I stop them?
The processes you see are the indexing workers which are parsing all of the files included in the side bar of your project(s) (yes, every single file) and building an index for Goto Anything. See Sublime Text 3 File Indexing.
Disabling All Indexing
This can be completely disabled by adding "index_files": false, to your Preferences.sublime-settings (Prefereces > Settings). To disable this system-wide, you add it to your Default settings file, or you can add it to your User setting file. Either will work.
Limiting the Scope of Indexing
However, if you would rather not disable indexing entirely, you can simply modify the scope of the files that are excluded from indexing:
(this is a good starting list, but feel free to edit to better fit your needs)
"index_exclude_patterns": [
"data/*",
"log/*",
"logs/*",
"node_modules/*",
"vendor/*",
"*.log"
]
Additionally, you might also want to expand what is considered a "binary" file (binaries are also excluded from indexing):
"binary_file_patterns": [
"*.bz2",
"*.cache",
"*.dds",
"*.eot",
"*.gif",
"*.gz",
"*.ico",
"*.jar",
"*.jpeg",
"*.jpg",
"*.pdf",
"*.png",
"*.swf",
"*.tar",
"*.tga",
"*.ttf",
"*.zip"
]
I have seen people suggest adding folders to the folder_exclude_patterns array, but that is the list of folders to hide from display in the side bar. While folders not displayed in the side bar will not be indexed, there might be files or folders that you do want displayed but don't want indexed; in such cases index_exclude_patterns should be used.
Limiting Indexing Per Project
Indexing exclusions can also be defined per project in the *.sublime-project file:
{
"folders":
[
{
"path": "src",
"folder_exclude_patterns": ["vendor"]
},
{
"path": "doc",
"index_exclude_patterns": ["*.md"]
}
]
}
Limiting the Number of Indexing Worker Processes
It is also worth noting that you can limit the number of indexing worker processes with "index_workers": 1, where 1 is the number of worker processes. By default that number is 0 which instructs Sublime to guess and the optimal number of workers based on the number of CPU cores available.
Removing the folder containing those two problem files did do the trick afterall, but only after I also removed the Javatar plugin. I've since added the Javatar plugin back, and I haven't add issues since, so if I were to guess is that when I removed the files project and restarted Sublime, the Javatar plugin still knew about them and was telling Sublime to index them. Once I uninstalled and reinstalled the Javatar plugin, after the files had been removed, everything seemed to work fine.

How do I configure Textmate2 to turn off Soft Wrap by default for all files?

I put a .tm_properties file in my home folder and also at the top of my source tree with the following in it, none of the versions had any effect.
softWrap = false
softWrap = :false
softWrap=false
Also with no effect, I put the line below section headers such as:
[ source ]
[ text ]
[ "*.*" ]
Would love to know what I'm missing here.
I have the following entry below and it work just fine. Try removing other file type specific configuration to ensure its not being overridden.
softWrap = false
Also do check the "global" defaults under
TextMate.app/Contents/Resources/Default.tmProperties
If you haven't already seen https://gist.github.com/1478685, do check it out. The tm_properties in your most immediate folder should take priority. So try and remove other setting and just test it with this one.
Alternatively, remove all other tm_properties and just leave the "global" one and test it out.
Finally do check out this discussion and the version of TM2 you are using. There have been certain fixes to softwarp, and it could just be a bug that you are facing.
EDIT
Also just FYI, I found this item in the latest release notes of TM2.(2012-02-18)
Cached .tm_properties files are now observed via kevent so changes invalidate the cache immediately (previously it could take up to 30 seconds before the updated file was read). On file systems without kevent support you need to relaunch TextMate to flush the cache.

Resources