How to load a tmlanguage file into SubLime Text 2? - sublimetext2

I have downloaded a typescript.tmlanguage so that I can have typescript syntax highlighting in the Sublime Text 2 editor.
How do I load this file in the editor?
(I have searched the editor's manual but there is no clear answer on this one)
Thank you.

You should create Typescript directory in your Packages directory and put typescript.tmLanguage in it.
Packages directory can be found with menu Preferences/Browse Packages....

Related

How to change file type of a file in PhpStorm?

I have a TypeScript project I manage with PhpStorm. All the *.ts files are properly recognized as TypeScript files and in my file types setting I have the *.ts file map TypeScript.
All the files? No, one file stubbornly won't be treated as a TypeScript file but is shown as plain text. I have no idea how to mark this one as a TypeScript file.
All the *.ts file have the proper ts icon next to them. This one hasn't.
When I open the rogue .ts file, PhpStorm tells me that there are plugins for that file type, yet if I try to follow that route, all it leads me to is for PhpStorm to try to install the TypoScript plugin for which I have no need at all.
I tried:
renaming file from *.ts to *.txt and back to *.ts;
deleting it within PhpStorm and checking it out via git again;
right clicking the file in the Project pane hoping a setting is there in order to mark it as a TypeScript file, yet no such things seems to exist;
invalidating the cache and restart.
It remains a simple text file without syntax highlighting and other TypeScript code importing this file have the error that the references cannot be found within PhpStorm.
It's a valid TypeScript project though, tsc on command line runs fine.
How can I tell PhpStorm to treat this rogue .ts file as a TypeScript file as well?
Go to Preferences > File Types > Text Files and see if the name of the file is listed there. If it is, delete it from that list.

How can I reformat Source Code for files without file extension in WebStorm 2016.1.3?

How can I reformat Source Code for files without file extension in WebStorm 2016.1.3 ?
Example: I've a automated_generated_json_file_without_extension in one line and the name of the files are always different. I don't want to configure all these file names in "File Types" Dialog and register new patterns.
In Sublime you can change the file type at the right bottom corner, is there a similar function in WebStorm?
Unfortunately you cannot change file type of the file on the fly in WebStorm.
Possible workarounds:
Have a set of files (e.g. test.json, test.js etc) somewhere in a project where you can copy-paste this file content, reformat it there and copy it back.
Use "Scratch files" functionality (Tools | New Scratch File...) and then the same copy-paste content to reformat.

Sublime Text 3 Default File Type on new file

I was looking around and the questions and answers did not seem to match what I am looking for (Sublime Text 3). Anytime I open a new file it defaults to a plain text file. I mostly work with PHP files so I was wondering if there is a setting that would be changed so that when I open a new file it will default to PHP.
I tried to find this directory path "Packages/Text/Plain_text.tmLanguage" here:
C:\Program Files\Sublime Text 3\Packages
C:\Users\user\AppData\Roaming\Sublime Text 3\Packages
But I did not find the "tmLanguage" files.
Reference: Sublime Text 2 - Default Document Type
The .tmLanguage files are within the .sublime-package files which are secretly simple archives holding all files necessary for a package to work.
Add a .zip extension to the .sublime-package file that contains the PHP settings and you can extract the .tmLanguage file you want as your new default.
Once you have that file, follow the instructions from the question you linked to and you should be good to go.
Set default file type in Sublime Text
Rather than messing with the files in your OS and adding a .zip extension to one of them …
… if you want to find the directory path to a built-in .sublime-syntax or a .tmLanguage file install PacakgeResourceViewer from Package Control.
After installing, use command palette to Package Resource Viewer: Open Resource and find PHP.sublime-syntax.
You can then see the path is Packages/PHP/PHP.sublime-syntax.
then:
Install DefaultFileType and edit its configuration file: Packages/User/default_file_type.sublime-settings as follows:
{ "default_new_file_syntax": "Packages/PHP/PHP.sublime-syntax",
"use_current_file_syntax": false }
Now your new files will default to sublime's built-in PHP syntax highlighting.

A PHP script file doesn't have PHP syntax formatting

In my PhpStorm, the file index.php, doesn't look like a PHP script, but a plain text file. How can I fix it?
Settings | File Types | Text files
Find and remove unwanted pattern there -- I expect this to be index.php or very similar
Similar SO questions:
PHPStorm renders a particular file name as plain text
Pycharm utils.py not getting syntax highlight
Follow this steps:
Open PHPStorm settings by using Ctrl+Alt+S
In search box type File types
Select file types option from left side panel
Find PHP Files (PHP) from Recognized file types
Check for .php extension in below area (Registered Patterns). If not found add PHP.
Right click on index.php and select "Mark as PHP".
(This option is there on PHPStorm 7.x, I'm not sure about 6.)

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