Could i write an extension to open an editor to side in Vs code - vscode-extensions

I would like to make a vs code extension for that so a user presses a key combination than a text editor will open to the side where he could enter lines of text then whenever the text changes I would receive events with the changed text. Could you suggest to me how to open the editor if is it possible?
Thank you for taking the time to read the question.
Hope you have a great day ahead.

You can use showTextDocument and use ViewColumn.Beside to open the editor to the side of the currently active one:
https://code.visualstudio.com/api/references/vscode-api#window
You can listen for text doc changes with the onDidChangeTextDocument event:
https://code.visualstudio.com/api/references/vscode-api#workspace
Here's info on creating a command to open the preview window.
https://code.visualstudio.com/api/references/vscode-api#commands

Related

Copying data from browser to a file

I am facing a problem, can anyone help me to sort this out:
Background: I have to create a backup of the code exist in the editor(Code mirror), so the use case is I have to copy the code from the editor and save it as .html file.
While using the element.getText() and writing to a file works fine but the issue is the getText()only get the code visible on the screen. Since the code lines vary so if I use javascript scrolls then it didn't work as some page on the editor (code mirror) would have 100 lines of code or some may have 2000.
Another solution I tried is to use Action class i.e mouse actions means Select all and copy i.e Keys.COMMAND, "c")).perform();
The Problem is here how can I copy the selected text to the clipboard or save the copied text to the string so that I can execute BufferedWriter class.
Would appreciate if anyone can help.
Sorry I misunderstood your question.
For the link https://codemirror.net/demo/theme.html, to get the code, I think you should first scroll to the bottom of the editor using executeScript(Scroll to bottom of div?). After that, element.getText() should give you full code.
Update: You can also select the text by clicking on the editor and then pressing Ctrl + A, after that get selected text by executing javascript on the browser (Get the Highlighted/Selected text). You can then handle the text within your test script.

How do you configure IntelliJ IDEA to place the cursor in the editor window after hitting enter on a file in the project window?

I'm big on not using the mouse, especially while writing code. I've noticed in IntelliJ IDEA 2016.1 that when I'm navigating in the project window, hitting Enter while a particular file is selected opens the file in an editor, but it doesn't place the cursor in the editor. Interestingly, if I double-click on the file in the project window, the cursor is placed in the editor.
How do I configure IntelliJ to place the cursor in the editor after opening the file via Enter from the project window?
To the best of my knowledge, I do not believe there is a way to configure what you are looking for. A search for focus in the settings didn't turn up anything.
That said, hitting Esc when in the project view will return you to the editor. So you would need to do Enter, Esc. If having to type two keys in a row bothers you, you could always record a macro (Edit > Macros) to do that key sequence and map it to a shortcut.

Associate .txt files with VB.NET Program

I created a super basic text editor which can read .txt files. I would like to know how I can set my basic text editor to the default .txt file extension so whenever the user clicks on a .txt file, at first it will show the "default program" window. If the user clicks on my program then the text files will be always opened using my program. How can this be done?
It depends on your version of windows, but in Windows 7/Vista you can click Start->Default programs
http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
In Windows XP it's a little more difficult:
Go to the Start menu and select All Programs.
Select Set Program Access and Defaults.
To select an option, click on the radio button beside it.
If you need to expand the option, click on the double arrows for that option on the right side of the window.
http://support.microsoft.com/kb/332003
If you want to do this programatically, you have to edit some registry settings. See here: http://msdn.microsoft.com/en-us/library/windows/desktop/cc144154%28v=vs.85%29.aspx

Visual Studio 2013 VB intellisense

Apologies upfront if this is a silly question, but it's annoying me to no end and I can't figure it out.
I'm using Visual Studio 2013 Professional, and I usually code in C# where when using the Intellisense, when I press Enter to select a method or something it adds my selection and I can continue typing on the same line.
But at the moment I'm working on a project which is in VB.NET, and when I use the Intellisense in the same way it puts my cursor in the next line, i.e. I press Enter to select whatever, it adds my selection and starts a new line, so I have to press the Backspace to go back to the previous line. It's so annoying!
Is there a way to change this behaviour so the cursor doesn't go to the next line? I've looked at the settings available in Tools > Options but can't figure it out, and searching Google for anything similar hasn't been successful.
Found it here (paragraph List Members)
You have toggled to suggestion mode instead of completion mode.
You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode.
So, either use TAB/SPACEBAR (as I said in the comment) or press CTRL+ALT+SPACEBAR to switch back to completion mode.
EDIT: I've found out that whenever you type Stri (String will show highlighted in the list now) and you press . (dot) it will autocomplete and stay at the same line.
I think your way of doing this in C# isn't possible in Visual Basic.
I had the same problem and discovered that Auto list members was not enabled on my machine. It's under Tools > Options > Text Editor > Basic > General. This gave me the intellisense I was looking for.
Simple thing which can be used when you face this kind of issue is to press
tab key instead of Enter key when the IntelliSense provided me prediction list.

How to launch an SP 2010 Dialog Window Maximized

I have modified EditForm.aspx of a list in SharePoint 2010. I need to launch the dialog window (that's what EditForm.aspx seems to be launched as) maximized, but I haven't been able to find the correct setting to tweak.
A quick web search suggests to use the showMaximized:true style setting, but I am unable to find the element in EditForm.aspx to apply this attribute to.
If you want to remove ALL dialogs from a list, go to:
list settings -> advanced -> dialog -> turn them off
But if you just want to change the edit button, you will probably have to create a new edit <CustomAction> that uses javascript, see this example:
http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx
Its for a different button, but you should get the idea.
And then you will need to build a <HideCustomAction> to hide the original edit button
Check this : http://www.wawawum.com/blog/post.aspx?id=66a5aed2-f530-4687-bd42-1ef0fb379544
Add a Content Editor WebPart to your EditForm, then put the code found in this blog to maximize the Dialog when opening it.
Works very well for me.