How to open multiple clearcase views in separate vscode sessions - visual-studio-code

I am trying to work on two different ClearCase views in two VSCode sessions.
But, when I open the second instance of VSCode , it defaults to the first view and changing the view in the second session also changes the set view in the first session.
Is there a way to work on multiple views in separate VSCode windows?

One approach is to work with ClearCase snapshot views, which are loading their files to a fixed path, one per view.
Then each VSCode session can register a VSCode workspace which opens its own dedicated folder, again, one per view.
A similar approach is possible with ClearCase dynamic views, provided you do not do a cleartool setview, which would attempts to mount each view on the MVFS mounting point /view (or M:\ on W: only one view at at time can be attached to /view.
Using setview would explain why the second VSCode opens files of the first view, if it attempts to open files mounted by the first view.
But for dynamic views mounted on distinct paths, the same scenario than snapshot view can apply:
open the right root folder of one view
save that as a VSCode workspace file
when you reopen that file, you will reopen the right view files.

Related

VSCode: Can I open individual files instead of workspaces?

Opening whole directories (each one requiring a new window) doesn’t play well with editing lots of little scripts/config files scattered in different folders.
Yes, you can! Here are three ways:
Either by running code {yourfilename here} in a terminal.
Dragging the file from a file explorer onto the open VSCode window.
Use the menu item "File/Open file... (Ctrl + O)", see image.
You don't have to open a folder in VSCode!
In VSCode create a New Window (instance) and open all the files you're interested in from anywhere on your disk.
If you want to keep this selection for later, you can Save Workspace As .. for later usage.

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)

Change a root folder for a view in StarTeam

I'd like to change the "Root folder" for one of the existing views in StarTeam.
There's a possibility to change a working folder (via "View / Properties" dialog), but that's not the feature I need as it is done locally only.
Does anyone know how could I change it so that any user who switches to this view sees the new structure?
Within a View you can set the Default Working Folder that will be shared initially for ALL users of that View within a Project or you can set an Alternate Working Folder that is specific to only YOUR local workstation. The screen is under View->Properties:
You can find additional information about this within the documentation: Changing a View's Default and Alternate Working Folders

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.

Eclipse - easy access to frequently used folders?

Does anyone know of a plugin for Eclipse to use 'favorite folders' in a project ?
There are maybe 2 or 3 folders inside my project (of 1000+ folders) that I regularly switch between. It's really a drag to use the scrollbar in the Project Explorer each time to get to the right folder, since some of them are 5 levels deep in the directory tree.
It would be VERY nice to have a separate small panel below the Project Explorer to access these frequently used folders...
Eclipse now allows to bookmark folders -- the corresponding bug is fixed.
When you select a folder in the tree, the add option might not appear in the context menu, but it does appear in the application menu at Edit -› Add Bookmark.
However, while the folder then is listed in the bookmarks view, nothing happens when it gets clicked. One has to right-click the bookmark and then select Show in... to get the actual folder focused in the navigator/explorer. IMHO it is better (i.e. more robust) than the workaround using file-bases bookmarks, but it still could be improved (e.g. without the context menu extra clicks to switch to a bookmarked folder).
At this point, looks like https://stackoverflow.com/a/12365878/470838 is more relevant than this answer.
Note quite what you want, but Eclipse allows you to bookmark files. You could use this to bookmark a file in each directory and then use the Bookmarks view to move around from there.
This topic may be old, but I think this solution is good enough
Use "Working set" feature to group files/folders you need into a working set
Create a working set
Open a view like Project Expoler, Navigator or PHPExplore (if you
have PDT) or Package Explorer (if you are a java coder)
Click "View Menu" (small triangle icon) at top-right of the view opened
Select "Select Working Set..."
Choose "Selected Working Sets" option
Click button "New"
Pick a type you need, click next, give it a name (eg: MyBookmark) and choose any
project(s)/folder(s)/file(s) shown under "Working set content" to include in MyBookmark and finish
Open/edit/close a working set
To open a working set (MyBookmark), follow steps 1 -> 4 above and
check the checkbox named MyBookmark, click OK. Now the view display only contents of MyBookmark
To edit MyBookmark contents click "View Menu" and select "Edit Active Working Set..."
To close current working set and back to original display click
"View Menu" and select "Deselect Working Set"
I would really recommend Mylyn (a task-focused interface) for this kind of workflow.
By defining the appropriate task context, you could switch to such tasks and see only the folders you need (no dragging involved) as opposed to see everything.
To add to VonC's answer:
Adding files into Mylyn's current task context using Bash
Currently there are two main ways I have found to manually add certain files into the activated Mylyn task context when you activate a new task. This works well for me because I always have a prompt open or accessible at a keypress.
In a bash prompt, run: eclipse <file_to_add>
With Focus on Active Task selected in Eclipse's Project Explorer...
Run touch <file_to_add> (either create a new file, or update timestamp of existing file)
In Eclipse, click on your project and press F5 to Refresh. The file should show up.
The first one will open the file you want to work on in Eclipse, and it will show the file in the task context. The second one forces Eclipse to see that the file was accessed, and it will add it to your task context.
Setting up commonly used directories in Bash
To solve the problem of having to cd into your most commonly used folders all the time, use bash's built in directory stack feature.
Create a script (preferably in your personal home bin) called sh.init
Add something like this to the file:
pushd ~/src/some/seldomly/used/path
pushd ~/src/some/less-seldomly/used/path
pushd ~/src/some/commonly/used/path
pushd ~/src/some/most-commonly/used/path
Make sure to chmod +x sh.init. (I added this into a function in my .bashrc myself that does a couple other things, but a separate script is probably easiest.) Now run this script whenever you want to add these dirs into your directory stack, and end up in the last one. There is a good tutorial on how to use these functions here or in the bash man page ( Look for dirs under Shell Builtin Commands section). You will always be in the directory on the top of the stack. Here are some quick tips:
Use dirs to display the stack ( will display on one line. Top = left, Bottom = right )
Use dirs -v to display the stack in multiple lines with numbering ( makes top / bottom order make more sense graphically )
To switch the top 2 directories, run pushd
To cd into the third or fourth dir from the left, (effectively rotate the stack) use pushd +2 or pushd +3 respectively.
These general rules apply when rotating the stack:
Numbering always starts from 0
If counting n dirs from the top (left), use +n
If counting n dirs from the bottom (right), use -n
Use popd to pop a directory off the stack, and cd into the new top dir on stack
Use dirs +n or dirs -n to display the n'th dir from the top (left) or right (bottom) of stack.
Use pushd <new_dir> to push a new directory onto the stack (and cd into it)