VSCode: open files related to a given project on a specific editor side - visual-studio-code

I am working on a vscode workspace, and in this workspace I have two separate projects that I need to constantly open files from one or the other. The explorer window on the left shows both projects, and were added using the Add folder to workspace... option if it's useful to know.
Now, since the projects have similar structure (both have an api.py file for example), I started keeping the open files from project1 on the left side of the editor, and I'm using the right side for project2. When I open a new file, it gets placed on the side of the screen that I have currently focused.
What I would like, is to know if there's an option to force files from project1 to stay on the left, and files from project2 to stay on the right.
The image below shows what I am trying to accomplish

This issue appears to be exactly on point:
Open files from folders in a fixed editor group.
Unfortunately, it was put on the backlog candidate list and didn't get the necessary votes and so was closed. So no built-in way to do this. Might be a good extension candidate.

Related

Eclipse to IntelliJ transfer

I have copied my src package structure from eclipse to intellij and it makes this structure within src folder:
How do I make it dz1.drugi so I can one click expand all to my classes?
Another question is how to select default project folder as it is "workspace" at \Users\{Name} for eclipse. Right now, when I create new project like this:
it saves it without workspace (or projects folder) at \Users\{Name}.
Click on the cog icon at the top-right of the explorer view, and check the "Flatten packages" option.
That said, If you get used to keyboard shortcuts top open classes and files, and navigate through recently opened files, you'll quickly see that you'll amost never use the explorer view anymore.
Project view has an option to compact empty middle packages, enable it. You can also use Flatten packages option. Actually, your question is a duplicate of this one.
IntelliJ IDEA remembers the last location you've used when creating a new project. Once you want to create another project, the location one level upper of the previous project directory would be suggested. So, create a project in C:\Users\someuser\workspace\myproject1 and IDE will suggest C:\Users\someuser\workspace\myproject2 for your new myproject2.

Visual Studio Code - Tabs (editors) of the same project in multiple screens

Using multiple screens I normally place multiple classes (files) in different screens, this helps me a lot while refactoring, checking tests and comparing changes.
Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor.
I checked the documentation and plugins, but the only way I found, is to open two windows, pointing to the same project (folder) and put those in different screens.
I don't like this solution, that causes also some problem when I watch code changes using TypeScript.
Any suggestion?
I use Windows 10, latest version of VSCode.
A solution is to press CTRL+K and after releasing CTRL, press O.
This will open the current file in a new window.
There are few things I don't like about this solution:
- Drag and Drop does not work
- Create a new instance of VS Code resulting in (for me) 180MB of ram used
- To open the file it takes to me few seconds (quite slow)
- The file remains open in the original window as well
Update 20/03/2019:
There is a feature request you can track here:
https://github.com/Microsoft/vscode/issues/10121
And an explanation about why this is difficult to implement here:
https://github.com/Microsoft/vscode/issues/10121#issuecomment-345770248
Update 20/03/2019:
Another important side effect highlighted by #Mär is that:
the IntelliSense fails to establish references it had when the file
was opened in the window, where the entire project is opened
The easy way but with the same drawbacks. More ram and resources will be used. Is to wrap your project in a folder.
It's the best possible thing. As by now!
=> Duplicate the workspace.
Open the command pannel ctrl+shift+p or F1.
Then write dupl
You'll get that
That's it.
More
If you want to add more folder to the working space.
=> go to File then Add Folder To Workspace
You can add as many as you like.
 Also better more
You can open a new window (ex: ctrl+n)
And then go File > Add Folder To Workspace.
And start adding folders to your new Workspace. You can add any folder, that is already open or not. That's too way great. You can have all the needed folders for example in the second screen.
A little hack I used is to just stretch the editor window to fill both screens and split the view pane between the monitors such that both screens show just one open file.
This is a cheap hack that works without opening multiple instances of VSC.
It may not be the proper solution, but it works without eating up all my system memory.
I found the following way to work on multiple monitors (important: they must be the same size and resolution):
open a visual studio in windowed mode on the 1st monitor (in my case it is a left monitor)
move the window to the (left) top corner
stretch window to the 2nd monitor (right) bottom corner
split screen by clicking “split editor” several times
move the code sections separator to the edge between the monitors
This is old qestion, but such way can be useful for someone. It is not very convenient, but it works. The solution may have already appeared in the VS itself, but I didn't find it.
Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor
Actually, VSCode 1.57 (May 2021, 4 years later) will propose something close:
Improved editor drag and drop across windows
Support for dragging editors to other windows was improved in this release. You can now drag diff editors, custom editors and the entire editor group to another window to open the editors there.
My solution was to use Remote-ssh to connect to self and open in another window. This does take extra resources. But I find this comfortable as I don't need to create additional workspace.
For me on Ubuntu the solution was to create a project folder symlink and ope it in a new window (as it won't open the same folder in another window)

How do I configure Eclipse and Maven to not duplicate folder listings?

Help me please. The problem I'm having is that in Eclipse In the Package Explorer, a Maven project that contains sub Maven projects displays duplicates of the same folders. In addition this causes the 'Ctrl + click' to not work.
So for example if you have a folder hierarchy, and almost each folder is another sub project, such as the following....
1/projectX-dev
2/projectX-dev/web-services
3/projectX-dev/web-services/mapping-data
4/projectX-dev/web-services/mapping-organizations
5/projectX-dev/web-services/metrixs
6/projectX-dev/web-services/metrixs/data-ingest
7/projectX-dev/web-services/metrixs/organization-feeds
Then in my package explorer I would have 7 listed items because each folder has its own .pom file. So for example expanding 5 it would contain the code that is also present in 6 & 7 because it is the parent folder which of course makes sense, but this is most annoying because now there are three locations where I can go to get at information where all I would want is for #1 to be displayed.
In addition to the layout annoyance, in Eclipse it seems that if I open a file under one of the listings over another then the 'Ctrl + click' to navigate to imported class methods no longer is supported. I am growing tired of this and need some clarification on how to just import the Maven projects and have it where the 'Ctrl + click' functions and the display in the Package Explorer would be 1/projectX-dev and that is it. I don't want all the other listings just the main parent folder.
As you can see in the image, the expanded folder netops-nice-jira-dev has items which are all listed at the top level as other projects. i.e. ui-extensions & web-services. The rest-service is a project also and it resides inside of the web-services project. So it is pissing me off how if I open a file from one location it allows for the proper interaction with the file such as Ctrl Click to track methods whereas with opening the file from another location it acts like a plain text file. 1 I don't want all these items to be duplicated in my view I just want the main top level project to be displayed and keep it simple to navigate down the structure rather than trying to find the proper place to open a file from.
Any suggestions on how to NOT display all the projects that are within the project?
The friggin previous people who put together this project created Eclipse projects within Eclipse project folders and everything was added to the Eclipse project view so things are all screwy.
If I open files from one project normal IDE functions will work, if I open the files from within one of the many other projects then the IDE functions don't work where i'm being told the project does not exist on the build path.
How frustrating!

Multiple editor windows with multiple tabs

Very often I work with multiple projects in MATLAB and have a group of files for each project that I access at one time. Having all files of all projects open causes a lot of clutter in the workspace. One can do this for one single set of files by docking which is well known.
Is there a way to tab projects, or have multiple MATLAB editors (for each project) open with multiple tabs in each (with the projects files). The question can be found here too. In the same vein, are there other code editors which can be used to perform the same?
Project1
file 1.m
file 2.m
file 3.m
file 4.m
Project2
file 1.m
file 2.m
file 3.m
file 4.m
Either in the same window, or in different windows.
Unfortunately I don't believe MATLAB can do that kind of project/file management for you, which is why I use Sublime Text 2. It's perfect for that kind of project/file management... and not to mention the awesome shortcuts and quick editing tools to help you code faster.
Check them out: http://www.sublimetext.com/. The one drawback is that it's nagware. It is free to use, provided you can bare the popups to buy a copy of the software every now and then. Once you buy it, the popups go away. Give it a try and see how it goes!
If someone still need a solution for that-
You can just drag a tab of one file to the side, or bottom of the space of the editor, like that:
And the result will be:
Now you can drag in the same way other tabs to the new tabs group, and you have two separate tabs groups (but one Editor window..). You can of course drag the middle edge line to the right-end, and work fully only with the first group, or drag it to the left-end and work fully with the second one.
Note for one drawback here- if the line is in one of the ends, you don't see the tabs status and files names of the hidden group, and if you forget that you opened some file there and try to open it again, you will not see it opened, or any change in the IDE, because the control goes to the already opened tab but you not see it.

In intelliJ/Eclipse is there away to never open files from bin or target or build? or warn?

I just lost another 20 minutes because my IDE (sometimes I use IntelliJ, sometimes I use Eclipse) opened a file that was from the "bin, target, or build" folder... and I mistakenly thought it was from the src folder.
As I developer I almost always want the source code to look at, not build output artifacts... is there away to make the IDE either not present these as choices, or have it warn me visually that the file is not source (like surrounding the editor in a thick band of zebra stripped yellow and black lines? )
In IDEA output folders are excluded by default and are not visible in the Project View. Navigation to files from excluded folders also will not work. Double check that these folders are marked as Excluded in the Project Structure | Sources tab.
In Eclipse I use package explorer to navigate between source files, jsp, etc. It does not show any build/target/bin folders and there possibility to configure filters for it (Small down faced arrow next to titlebar)