Hide files with certain extension from specific folder in Sublime Text Editor? - sublimetext2

Is it possible to hide all the files with certain extension from some specific folder in your project directory in sublime text editor 3.
I have found another related stackover-flow-question

It's not clear from the documentation, but you can specify folders in the file_exclude_patterns setting in your project file.
Example:
{
"folders":
[
{
"path": "some_folder_path",
"file_exclude_patterns": ["messages/*.md"]
}
]
}
would exclude all files with a markdown extension (.md) from the messages folder, leaving all other .md files to be included in the project, for example some_folder_path/readme.md.
Note that the above could exclude files in a descendant of the project root, so you may want to prefix the project root dir in your setting:
{
"folders":
[
{
"path": "some_folder_path",
"file_exclude_patterns": ["some_folder_path/messages/*.md"]
}
]
}
otherwise, some_folder_path/some_other_folder/messages/*.md would also be affected, because Sublime Text doesn't constrain the patterns to the project root automatically.

Related

Pushing an empty file instead of another to github

I have a local repository with a config.json file which contains sensible configuration data. This file follows a schema found in config.json.template. The two files look like these (not actual content):
config.json.template
{
"username": "",
"password": "",
}
config.json
{
"username": "admin",
"password": "123456789"
}
Instead of placing the config.json in my .gitignore, is there a way to replace it with config.json.template at push-time? So that my repository will contain a config.json file that just needs to be filled out by the user.
You're better off pushing just the template file and not a file that you want people to modify. People working with your repository won't appreciate having a tracked file that they must modify, since it means that git checkout and other operations will sometimes require them to stash first and then unstash.
In general, files that are intended to be modified on a per-user basis, like configuration files or editor files, shouldn't be saved directly in version control.
You can just simply push config.json.template as it is.

Angular8 How to load resource inside a sub project assets folder in a good practice way?

I'm working with angular 8, I created a sub-project inside the main project. The folder structure looks like the screenshot:
Now I'm working on my sub-proj01, and I want to use an "img" tag to import an xxx.svg file inside the sub-proj01's assets folder.
I tried
<img src="assets/xxx.svg">
, but I got 404 after I run ng serve in the aggregator folder.
and I tried
<img src="projects/sub-proj01/src/assets/xxx.svg">
but I got 404 as well.
So could anybody give me some suggestion that how can I get this? Many thanks!
Go do angular.json file and in the array called "assets" you will put a object with "glob" that define what you wend copy, "input" that define the path of your subproject assets, and output" that is the final destine to copy everting.
"assets": [
"src/favicon.ico",
"src/favicon.png",
"src/assets",
{
"glob": "**/*", //COPY ALL THINGS
"input": "projects/subproject-name/src/assets", //OF THIS DIRECTORY
"output": "/assets/" //TO THIS DIRECTORE ROOT
}
],

Eslint allow extraneous dependencies in tests

In my test files I get eslint error on some imports like
'import/no-extraneous-dependencies': ["error", { devDependencies:
true, }],
this happens only in my second tests directory in some subfolder
in my root tests directory I don't get this errors
I didn't find any settings in package.json or .eslintrc which could cause differentiation.
Currently I have to use
/* eslint-disable import/no-extraneous-dependencies*/
in my test files which we don't like
If I add
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }]
to .eslintrc th rule is off everywhere not just in tests
How can I switch this rule of except of placing .eslintrc to the tests folder? which folders use devDependencies?
You can use an array of globs as follows, which will allow extraneous dependencies to be access from test files where file name matches **/*.test.js
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js"]}]
You can create a .eslintignore file in the project root to disable ESLint for specific files or directories.
And put the following line into it:
test/*
Reference: http://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories
Edit:
If you want to ignore a specific rule for a particular directory, you can put another .eslintrc file in that directory.
Reference: http://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy

Sublime text 2 find in folder with file extension

How do I search in a folder in sublime text 2 with file extension?
My where when I use:
*.js
searches globally for all js files.
If I try to restrict it to a folder:
/project/*.js
it matches nothing.
Instead of this:
/project/*.js
Try using this:
project .js
This should match files which have project in the path and have a .js extension
EDIT: The above assumes you're trying to find all the files with .js extension using the Goto Anything feature in Sublime Text.
In case you'd like to search within .js files located within a directory, you can add an Include Filter in the search path:
/project,*.js
This will search for the text you've entered, limiting the scope to files within /project and it's sub-directories having the extension .js.
Reference: Sublime Text Docs - Search Scope
EDIT 2: For Sublime Text 3, refer Simons answer below.
godfrzero's answer does not work in Sublime 3 as it actually includes ALL JS files plus ALL files in the project folder.
Instead, you need to specify it similar to how you had it originally...
project/*.js
Note that there's no leading slash, as that will treat it as an absolute path which you won't want in most cases. To include multiple file types within the folder, I think you need to specify it like this:
folder/*.ctp,folder/*.php
This will match any of the following files:
/app/folder/example.ctp
/app/folder/example.php
/app/folder/subfolder/example.ctp
/app/long/path/folder/subfolder/example.php
I know you asked about Sublime 2, but hopefully this helps others (like myself) who are Googling for such advice.
Simon.
My Sublime ver: 3.2.2
Adding to above answers, I was trying to find in all python files starting with test_ . so this is how I did it.
After pressing Ctrl+Shift+F, in the window.
Where : /home/WorkDir/test, test_*.py

How do I get the absolute path of the chrome extensions directory?

I'm writing an app that has full access to the file system and I want to be able to get the absolute path of my extension's directory. How would I do this?
My app has permissions to "<all_urls>", {"filesystem": [ "write" ]} and has the "allow access to file urls" checked.
If you mean the file system path, that differs on each operating system. You can find it by doing a file search for your extensions identifier.
If you want a chrome reference, you can use:
chrome.extension.getURL('');
You can also provide something in the string and it will give you the path that you would need to reference the file contained in your app.
Example:
chrome.extension.getURL('index.html');
Returns:
"chrome-extension://gbchcmhmhahfdphkhkmpfmihenigjmpp/index.html"