Rubymine creating text files by default [duplicate] - rubymine

This question already has answers here:
Pycharm utils.py not getting syntax highlight
(6 answers)
Closed 3 years ago.
I am attempting to create a .rb file within Ruby, using these steps:
1. Create New File
2. Name new file "a"
3. Associate file to .rb filetype
This creates a file named "a" that works fine; however, when I rename this file to a.rb it immediately converts the file to a text file. Why is that?
I have been creating files this entire time by creating a new file and naming it "a.rb" from the start, and it automatically associates it to a ruby file. Now it just associates that naming to a text file and I have to leave off the .rb and manually assign the filetype later. What changed?

FOR MAC USERS you can find the settings you need to fix this here:
RubyMine | Preferences | Editor | File Types
The above answer is correct – removing a.rb does solve the problem – and I realize that this question is two years old now… But having come across this problem today and not having been able to find a solution for the longest time, hopefully this will help someone else too. Default Settings under File does NOT have this tab in the current version of RubyMine on Macs, and it took me forever to find the tab where File Types is.

Related

How can I find out what file mode VSCode is using for an open file?

I was trying to get yapf configured for a Python project, and so I created a .style.yapf file, which VSCode did not recognize by its extension. I thought it was in TOML format, but when I changed the file association for .style.yapf to TOML, the parser shows an error (because values aren't quoted). So I tried changing the name of the file (not really a solution, because the tool is looking for a file with that name), and found that if I change it to a name ending in .cfg, VSCode seems to parse and highlight it appropriately. Unfortunately, there doesn't seem to be anything in the list of file associations corresponding to this file mode.
I expected to find a cfg mode in the file associations list, but there wasn't an entry with that name, nor was there an entry that used the same gear icon displayed next to the open file name in its tab (which I have been assuming is an indicator of the mode that VSCode is using to display and format the file).
Is there any way for me to get VSCode to tell me what the current file mode is for an open file? Or give me a list of the default associations?
I'm more interested in understanding the tools in general than solving the one minor annoyance that sparked the question, but I'll settle for a solution to that problem, too.
Edit: Here's the content of the .style.yapf file in question:
[style]
based_on_style = google
If I rename the file to .yapf.cfg (or any other name ending in .cfg, I believe), it gets handled properly, but all of the file associations I've tried (including ini, Properties, and TOML) indicate an error because there are no quotes around google.

Shrink down empty directories explorer in VSCode? [duplicate]

This question already has an answer here:
Is there a way to flatten or merge single-folder folders in vs code explorer?
(1 answer)
Closed 3 years ago.
I'm looking for some way to reduce the visible size of directories in the explorer, that only have one directory/file in them. I'm not quite sure how to explain this, but basically I want to turn this:
OPEN FOLDER
-ChildFolder
--GrandchildFolder
---GreatgrandchildFolder
---file
---file
Into this:
OPEN FOLDER
-ChildFolder\GrandchildFolder
--GreatgrandchildFolder
--file
--file
GitHub does something like this, for example on https://github.com/Bukkit/Bukkit/tree/master/src (a java project), you see test/java/org/bukkit (hovering shows "this path skips through empty directories").
Is there any way to do this in VSCode? It's pretty minor but would be really nice to have when working across multiple java projects.
This should be available mid-december 2019 with VSCode 1.41.
Compact folders in Explorer
In the File Explorer, we now render single child folders in a compact form.
In such a form, single child folders will be compressed in a combined tree element.
Useful for Java package structures, for example.
Setting explorer.compactFolders controls this behavior.
By default, this setting is turned on.

Is there any concept of defining global variables that can be used by various files in a project? [duplicate]

This question already has an answer here:
How to read a CMake Variable in C++ source code
(1 answer)
Closed 6 years ago.
In my project, I want various C files, Header files, cmake files, rpm spec files, java properties files etc to use a single macro(say version number) (or atleast fetch version from a single file). How can i realise it?
For different source code types it will be tricky to use the same include mechanism. But you can use an autocode to create different output files eg. (systemversion.h, systemversion.java, systemversion.txt) and include them into your cpp/java/rpm files.

How to include our own mfile into matlab library? [duplicate]

This question already has an answer here:
How to Set Path in Matlab?
(1 answer)
Closed 7 years ago.
I have created my own mfile and would like to add it permanently lie built in functions so that I dont have to specify path. Is there a way to do it?
You should store your .m file (either script or function) in a folder belonging to the MatLab search path.
To add your own folder to the MatLab search path you can use eiterh:
the Set Path tool, available on the MatLab Home toolbar
use the buil-in function path (from the Command Window or, for example, as part of a script)
E. g.
path(path,'c:\my_folder\my_sub_folder')
Hope this helps.
Write your file and save it and then add the containing folder to the MATLAB search path. You do not need to look for it every time.
addpath('c:/matlab/myfiles')
Note: your filename should not exist within MATLAB, otherwise your file would be the default one, when you call that command.
You can also do most of the work from command-line:
First, create a folder,
mkdir('c:/matlab/myfiles')
Add it to the top of your search path,
addpath('c:/matlab/myfiles')
and then save the search path for future MATLAB sessions
savepath c:/matlab/myfiles/pathdef.m

MATLAB add path temporarily [duplicate]

This question already has answers here:
Access m-files in a subfolder without permanently adding it to the path
(2 answers)
Closed 7 years ago.
I'm working on a project containing some subprojects. Each subproject is located in a own folder.
projDir/subProj1
/subProj2
and so on. Each subproject is a standalone running project. But now I want to use some functions of i.e. subProj1 in subProj2. But the functions in subProj1 should not be visible in general. So it is no good idea, to add the subProj1-path to the MATLAB-Path generally. Hence, I want to add this path in my .m-file stored in subProj2 and after finishing this script, the path should be removed (automatically) by it's own. Is there any possibility, to add a path temporarily to the MATLAB-path variable?
The addpath function only adds the files/folder to your path for the current Matlab session, assuming you don't call savepath. You also might find the genpath function helpful if you want to add subfolders.
You can use path(path_to_add,path) to add a path to the current path variable. Unless you do savepath you won't affect the global path.
I would do path(strcat(pwd,'\subProj1',path) etc. in the config .m script you have.