visual studio code - debug menu bar gear icon missing - visual-studio-code

I am not seeing the small gear icon beside the play button in debug menu bar . I played around in settings and set true for all options under Debug, but still I cant see that gear button.How do I make that available in visual studio code 1.10.2
I was following some steps from here where i need to click that gear icon.

VS Code can be used with single files, or with a directory as a workspace. Within the Debug view, if you only have single files, you'll only get the green "play arrow", and VS Code will try it's best to debug the file.
To get the gear icon, you'll need to open the workspace directory of the file(s) you want to debug (and this is where you want to be).
That gear icon is for editing a launch.json Launch Configuration, which you don't have one yet, so there's nothing to show (yet).
If you hit the play icon/green arrow, you'll open the Command Palette menu which will give you a selection of mostly complete launch.json templates for the language and/or toolchain you picked in the Command Palette menu.

I had the same issue.
Firstly ensure you have a proper configuration in launch.json.
Then open Debug menu and choose Start Debugging (or just press F5).
It's caused that Debug button/menu appeared.

Select Start Debugging (F5)
Choose Unity Debugger
Click Create launch.json file
This should create a launch.json file for you and you will then see the gear icon.

I am not sure what I did but while playing around in visual studio code the gear icon appeared. If someone has a clue as to why it would have appeared , please share. Heres the screenshot

Related

Error: Not applicable for the "main.dart" configuration

I cannot run my code on any emulator in Android studio... I have been despritely trying to solve this issue. the section is greyed out at the top and when I press play nothing happens. Any suggestions? Btw I have tried almost everything i've seen on the internet for this issue, I assume it has to do with [Run > edit configurations]
click here for reference image
Next time on opening studio click on the dropdown devic menu on the left side of "main.dart" then click on your emulator. If your emulator doesn't show up then click "refresh" and then click on yur AVD in the drop down.
After that click on the green play button then wait for a while for it to compile.
Hope this helps you, if you still don't understand drop a comment I'll send images.

How to open files in new tabs in Visual Studio Code

I recently started using Visual Studio Code and I would like to know, is a way to open files in a new tab? Currently whenever I open a new file the files I currently have open disappear. I say new tab, but any option that will let me open a new file in the same window as the old one works.
I have tried disabling Preview Mode through the workbench settings as shown in this answer: How to config vscode to open files always in a new tab?. However, when I choose Open or Open Recent the new file still replaces my old file.
Thanks.
Once you have to open your settings file, add the "workbench.editor.enablePreview" property and set value to false.
For 1.21.1 version.
In user settings =>
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen"
the best way i found.
Starting with VSCode 1.52 (Nov. 2020), you should not have any more issue: all files will open in new tabs, even in preview mode.
Better handling of preview editors:
Preview editors are now better handled with numerous improvements based on feedback and making this feature work more consistent.
The setting workbench.editor.enablePreviewFromQuickOpen is now disabled by default so that editors opening from quick open will not appear in preview mode anymore.
When you start a navigation (e.g. go to definition), the editor you start from will move out of preview mode to keep it open while the new editor will be in preview mode until you navigate further.
We changed all of our custom trees (the ones used from extensions or Git changes view for example) to work more consistently like our built-in trees (like the explorer).
This means, the following interactions now apply to all of them:
double-click or mouse-middle-click to open non-preview
Enter to open non-preview (Space to open in preview-mode)
Note: if you are the author of an extension that is leveraging our custom tree API, you can benefit from this change as well.
Make sure to use vscode.open or vscode.diff commands for the TreeItem.command and you are in!
A new menu item in the editor overflow menu allows to quickly turn off preview editors altogether:
You need to double click on the name of the file. Also, it needs to be done swiftly elsewhere you will be opening in the same tab.
You can drag and drop file near to the opened tab and the file will open in new tab.
Thanks everyone. Double clicking and dragging was useful, but it still didn't solve my problem when opening files from different projects with the "Open File" menu command. I found that Multi-root Workspaces is what I was looking for. https://code.visualstudio.com/docs/editor/multi-root-workspaces
This is likely due to Visual Studio Code opening file in what's called "Preview Mode", which allows you to quickly view files, ideally if a tab is in Preview Mode then its title in the tab bar, will be italic.
To disable Preview Mode set "workbench.editor.enablePreview": false in your settings file or use the "workbench.editor.enablePreviewFromQuickOpen" option to disable it only from the quick open menu.
Alternatively, use command palette CTL+Shift+P (to get all settings) VScode settings then in User => Workbench => Editor Management you can uncheck Enable Preview and Enable Preview from Quick Open to get the same results described above

Open files always in a new tab

I am using Visual Studio Code 1.3.1 with the newly introduced tabs.
When I click on files, the first file will open in a tab. If I do not make any changes to this file, the second clicked file will open in the same tab.
How can I avoid this and make Visual Studio Code always open a new tab?
When you [single-]click a file in the left sidebar's file browser or open it from the quick open menu (Ctrl-P, type the file name, Enter), Visual Studio Code opens it in what's called "Preview Mode", which allows you to quickly view files.
Preview Mode tabs are not kept open. As soon as you go to open another file from the sidebar, the existing Preview Mode tab (if one exists) is used. You can determine if a tab is in Preview Mode, by looking at its title in the tab bar. If the title is italic, the tab is in preview mode.
To open a file for editing (i.e. don't open in Preview Mode), double-click on the file in the sidebar, or single-click it in the sidebar then double click the title of its Preview Mode tab.
If you want to disable Preview Mode all together, you can do so by setting "workbench.editor.enablePreview": false in your settings file. You can also use the "workbench.editor.enablePreviewFromQuickOpen" option to disable it only from the quick open menu.
Before you can disable Preview Mode, you'll need to open your Settings File.
Pro Tip: You can use the Command Palette(shortcut Ctrl+Shift+P) to open your settings file, just enter "Preferences: Open User Settings"!
Once you've opened your settings file (your settings file should be located on the right), add the "workbench.editor.enablePreview" property, and set its value to false.
You can learn more about Visual Studio Code's "Preview Mode", here.
If you don't want to disable preview mode you can explicitly tell vscode to keep a specific tab open. As mentioned above a tab heading with italic text is in preview mode.
To get a tab out of preview mode you can either right click on the tab and choose keep open or use the shortcut cmd + k enter that is mapped to the command workbench.action.keepEditor.
Furthermore, double-clicking on a tab also gets it out of preview mode (verified in vscode 1.44.0).
I came up with the same problem, and open setting.json file, add the following:
"workbench.editor.enablePreview": false
Use workbench.editor.enablePreview: false to disable Preview mode completely.
Use workbench.editor.enablePreviewFromQuickOpen: false to disable Preview mode for the files open from quick open menu.
For 2020:
easy as pie, tap preferences (command ⌘ + , on Mac),
The secret is "Enable preview"
they added it right there:
Turn OFF (uncheck) for NORMAL behavior.
i.e., Turn OFF to avoid the "automatic closing" behavior.
Open in new Tab Solution:
Open the command palette by: Cmd + Shift + K
Open settings file by: Preferences: Open Settings (JSON)
Under user setting, enable Tabs by: "workbench.editor.showTabs": true
Watch for filenames in italic
Note that, the file name on the tab is formatted in italic if it has been opened in Preview Mode.
Quickly take a file out of Preview Mode
To keep the file always available in VSCode editor (that is, to take it out of Preview Mode into normal mode), you can double-click on the tab. Then, you will notice the name becomes non-italic.
Of course, you can simply double-click to open a file. This will open the file in a new tab, skipping the Preview Mode.
Feature or bug?
I believe Preview Mode is helpful especially when you have limited screen space and need to check many files.
For anyone who don't want to disabled Preview Mode.
As I read whole of comments and I found what I preferred that is the shortcut key to pin the opened file from Quick Open/Ctrl+P or that's mean to keep the opened file to the editor, and yes also don't need to switch your hand to the mouse to double-click on files list.
Thanks to #jontem and #MattLBeck.
Call save command with Ctrl+S (⌘+s on Mac) is the easiest way to reach what I preferred.
And if you found out you do this to keep opened file to editor quite frequently, yes I preferred you should setting the option "workbench.editor.enablePreview": false or "workbench.editor.enablePreviewFromQuickOpen": false as others mentioned before.
⚡ Actually, VSCode shows you the preview of a file.
You can disable the preview with this:
"workbench.editor.enablePreview": false,
⬇️ Basically just add these two settings and you're good to go.
Menu File → Preferences → User Settings: add this line
"workbench.editor.enablePreviewFromQuickOpen": false
If you want to open a file permanently from "Go To File..." (⌘P), press "right arrow" instead of return.
This also keeps the Go To File... search bar open so you can quickly open multiple files.
This is not a new answer. It is just showing how to do it via UI.
Open settings via File => Preference => Settings. The most upvoted answer is the correct choice.
Then in search field type Preview.
After that select Workbench and look for Enable preview options.
Uncheck the boxes.
You can do it via GUI
Search for preview
uncheck the options Enable Preview and Enable Preview from Quick Open
Essentially, there are three settings that one has to update (Preference >> settings):
workbench.editor.enablePreview: set this to globally enable or
disable preview editors
workbench.editor.enablePreviewFromQuickOpen: set this to enable or
disable preview editors when opened from Quick Open
workbench.editor.showTabs: finally one will need to set this
otherwise, there will be no tabs displayed and you will just be
wondering why setting/unsetting the above two did not work
From settings you can find edit settings.json
You need to search by Preview. Please check the below screen short.
Add the below code there:
"workbench.editor.enablePreview": false
enabling using GUI
go to Code -> Preferences -> Settings -> User -> Window -> New Window
here Open Files In New Window under drop down list select "on" that's it.
my VS Code version 1.38.1
You need to edit settings.json file, which is located at:
Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
{
"workbench.editor.showTabs": true,
"workbench.editor.enablePreview": false
}
As hktang above indicates:
one Click opens the file in preview mode (header text in italics)
Double click the same file, it goes out of preview-mode (header text changes from italic to normal font)
I think this is a "comprimise" feature allowing users, to "navigate" both worlds; preview and none-preview.
All you do is click the file to open it in the right panel.
Then immediately double click it to keep it there.
Or - just treble click. File opens in none preview mode.
HTH
Paul S.
Go to File > Preferences > Settings
Search for workbench.editor.enablePreviewFromQuickOpen
Set it to false or uncheck it.
to open another file in a new tab keeping the current file open,
first double click (left click) the current file
then click (single click) the new file
in this way, the new file will be opened in another tab
#OR
you can drag the new file from vs code project explorer and drop it beside opened tab, exactly where the new tab will be opened
Actually, VSCode shows you the preview of a file when you open it. If you want to open files in a new tab, just disable the preview with this setting (paste this in the settings.json file).
"workbench.editor.enablePreview": false,
— you can take it one step further and use this setting
"workbench.startupEditor": "newUntitledFile",
— It will open your VSCode editor with a blank new untitled file to quickly get started.
For those who using Windows OS:
Press Ctrl + Shift + P
Select Preferences: Open Settings (JSON) from the list
Select all and Paste this
{ "workbench.editor.enablePreview": false }
That's it now it will open in a new tab instead of replacing on the existing one.
For reference look at the screenshot below:
Simple and Best way is whenever you open new file it is in preview mode so simply press the CTRL + K and then press ENTER then you done with preview mode , Now this file will remain always open until you closed it that's what you need to do ....
1. Double-click your files instead of single-clicking.
Instead of single clicking on your files, (like I do in the previous GIF) double-click. This will tell VS Code that you want the file to stay open when you switch to a new file.
Here's my beautiful demonstration of this:
2. Double-click the tab you want to keep open
This works if the tab you are working with is in "Preview Mode" (italicized) and you want it to stay open when you open another file.
3. Right click your tab and select "Keep Open"
This one's self-explanatory. Simply right-click on the Preview Mode tab on the tab at the top of your screen (while it's italicized) and click on "Keep Open" once the context menu pops up.
Here's my beautiful demonstration of this:
When you single-click a file in the left sidebar's file browser or open it from the quick open menu (Ctrl-P, type the file name, Enter), Visual Studio Code opens it in what's called "Preview Mode", which allows you to quickly view files.
It's a feature, not a bug.
Very often while programming you will only need to open a file for a small window of time, to "preview" its contents.
FOR MORE INFO
One simple solution is, instead of making changes in settings of vscode, whenever you open a file through a reference,you will see that the file is in preview mode(the name of file is in italic) and in the sidebar you will see that same preview file in focus just double tap it and it will be pinned on the tab,so that it wont get replaced by another file in preview mode.
This is so confusing. All developers I asked didn't appreciate this default behavior.
I use cmd + P to open project files.
In my case, I also had to set workbench.editor.showTabs property to true (in addition to workbench.editor.enablePreview)
I'm not sure how it got changed to false. Maybe, I've accidentally set it to false using some shortcut.
Settings -> Workbench -> Editor Management -> Enable Preview
for me, shift + enter did the trick.
If you have opened a file in preview mode and want to open new file in another tab:
For Mac: use cmd + p -> find the file and alt + enter.

Eclipse - Avoid the scrolling behaviour upon closing a file

When you open a file in a project and then close it the Package Explorer will scroll to a file in another project if there is a file open there. Is there a way to stop this behaviour?
It sounds like you have the 'Link with Editor' option toggled on. This links the Package Explorer and the editor, which can cause the behavior you are seeing.
This option shows up in the Package Explorer header area as a button with arrows pointing right and left - if you hover over it, it'll say 'Link with Editor'. Click it once to turn it off, and it should stop automatically scrolling the Package Explorer view.

Xcode 4: How do you view the console?

I can't seem to find a way to have the console run (to show NSLog comments) in XCode 4. The normal method for the previous version of XCode does not work. Does anyone have an idea of how to accomplish this?
You need to click Log Navigator icon (far right in left sidebar). Then choose your Debug/Run session in left sidebar, and you will have console in editor area.
for Xcode 5:
View->Debug Area->Activate Console
shift + cmd + c
If you just want to have the log output display when you run your app then you can go into XCode4 preferences -> Alerts and click on 'Run starts' on the left hand column.
Then select 'Show Debugger' and when you run the app the NSLog output will be displayed below the editor pane.
This way you don't have to select on the 'up arrow' button at the bottom bar.
The console is no extra window anymore but it is under the texteditor area. You can set the preferences to always show this area. Go to "General" "Run Start" and activate "Show Debugger". Under "Run completes" the Debugger is set to hide again. You should deactivate that option. Now the console will remain visible.
EDIT
In the latest GM Release you can show and hide the console via a button in the toolbar. Very easy.
Here' an alternative
In Xcode 4 short cut to display and hide console is (command-shift-Y) , this will show the console and debugger below ur text edior in the same window.
You can always see the console in a different window by opening the Organiser, clicking on the Devices tab, choosing your device and selecting it's console.
Of course, this doesn't work for the simulator :(
There's two options:
Log Navigator (command-7 or view|navigators|log) and select your debug session.
"View | Show Debug Area" to view the NSLog output and interact with the debugger.
Here's a pic with both on. You wouldn't normally have both on, but I can only link one image per post! http://i.stack.imgur.com/4gG4P.png
Here's an alternative.
In XCode4 double-click your Project (Blueprint Icon).
Select the Target (Gray Icon)
Select the Build Phases (Top Center)
Add Build Phase "Run Script" (Green Plus Button, bottom right)
In the textbox below the Shell textfield replace
"Type a script or drag a script file from your workspace" with
"open ${TARGET_BUILD_DIR}/${TARGET_NAME}"
This will open a terminal window with your command-line app running in it.
This is not a great solution because XCode 4 still runs and debugs the app independently of what you're doing in the terminal window that pops up.