logo
down
shadow

Changing the cursor appearance in Visual Studio Code via extension API


Changing the cursor appearance in Visual Studio Code via extension API

Content Index :

Changing the cursor appearance in Visual Studio Code via extension API
Tag : visual-studio-code , By : Anthony Eden
Date : December 01 2020, 05:00 PM

around this issue I'm not sure about using the extension API, but you can do it via your user preferences file (which extensions must be able to modify because the "Vim" extension does it as mentioned in my comment above):
File -> Preferences -> User Settings
// Place your settings in this file to overwrite the default settings
{
    // Controls the cursor style, accepted values are 'block', 'line' and 'underline'
    "editor.cursorStyle": "block"
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to obtain the absolute position of text cursor in Visual Studio 2010 extension


Tag : chash , By : user135518
Date : March 29 2020, 07:55 AM
like below fixes the issue I am doing exactly the same thing in a current project, so here is the relevant code copy and pasted. I generate the activeWpfTextView object elsewhere using the following answer: Find an IVsTextView or IWpfTextView for a given ProjectItem, in VS 2010 RC extension.
    private IVsWindowFrame GetWindow()
    {
        // parent is the Microsoft.VisualStudio.Shell.ToolWindowPane
        //  containing this UserControl given in the constructor.
        var window = (ToolWindowPane)parent.GetIVsWindowPane();
        return (IVsWindowFrame)window.Frame;
    }

    private void DoShow()
    {
        var window = GetWindow();

        var textViewOrigin = (activeWpfTextView as UIElement).PointToScreen(new Point(0, 0));

        var caretPos = activeWpfTextView.Caret.Position.BufferPosition;
        var charBounds = activeWpfTextView
            .GetTextViewLineContainingBufferPosition(caretPos)
            .GetCharacterBounds(caretPos);
        double textBottom = charBounds.Bottom;
        double textX = charBounds.Right;

        Guid guid = default(Guid);
        double newLeft = textViewOrigin.X + textX - activeWpfTextView.ViewportLeft;
        double newTop = textViewOrigin.Y + textBottom - activeWpfTextView.ViewportTop;
        window.SetFramePos(VSSETFRAMEPOS.SFP_fMove, ref guid,
            (int)newLeft, (int)newTop,
            0, 0);

        window.Show();
        resultsList.Focus();
    }

Setting cursor position with Visual Studio Extension


Tag : chash , By : Chaz
Date : March 29 2020, 07:55 AM
To fix this issue I finally got it...
You just have to use the TextSelectioninterface where you have the method MoveToPoint.
// open the file in a VS code window and activate the pane
Window window = requestedItem.Open(Constants.vsViewKindCode);
window.Activate();

// get the function element and show it
CodeElement function = CodeElementSearcher.GetFunction(requestedItem, myFunctionName);

// get the text of the document
TextSelection textSelection = window.Document.Selection as TextSelection;

// now set the cursor to the beginning of the function
textSelection.MoveToPoint(function.StartPoint);

How to debug code compiled with Roslyn in a Visual Studio extension inside current Visual Studio host?


Tag : chash , By : Chaz
Date : March 29 2020, 07:55 AM
will help you Seems like this is actually impossible.
The current visual studio instance cannot debug itself.
Process vsProcess = Process.GetCurrentProcess();

string solutionPath = CurrentWorkspace.CurrentSolution.FilePath;

SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText($@"
            using System;
            using System.Threading.Tasks;

            namespace CodeGenApplication
            {{
                public class Program 
                {{
                    public static void Main(string[] args) 
                    {{

                    Console.ReadLine();
                    int vsProcessId = Int32.Parse(args[0]);
                    CodeGenApp.Test(""{solutionPath.Replace(@"\", @"\\")}"", ""{projectName}"", ""{_codeGenProjectName}"");
                    Console.ReadLine();
                    }}
                }}
            }}");

string assemblyName = Path.GetRandomFileName();

Project codeGenProject = CurrentWorkspace.CurrentSolution.Projects.Where(x => x.Name == _codeGenProjectName).FirstOrDefault();

List<MetadataReference> references = codeGenProject.MetadataReferences.ToList();

CSharpCompilation compilation = CSharpCompilation.Create(

    assemblyName,
    syntaxTrees: new[] { syntaxTree },
    references: references,
    options: new CSharpCompilationOptions(OutputKind.ConsoleApplication));

// Emit assembly to streams.
EmitResult result = compilation.Emit("CodeGenApplication.exe", "CodeGenApplication.pdb");

if (!result.Success)
{
    IEnumerable<Diagnostic> failures = result.Diagnostics.Where(diagnostic =>
        diagnostic.IsWarningAsError ||
        diagnostic.Severity == DiagnosticSeverity.Error);
}
else
{
    Process codeGenProcess = new Process();
    codeGenProcess.StartInfo.FileName = "CodeGenApplication.exe";
    codeGenProcess.StartInfo.Arguments = vsProcess.Id.ToString();
    codeGenProcess.StartInfo.UseShellExecute = false;
    codeGenProcess.StartInfo.CreateNoWindow = true;
    codeGenProcess.StartInfo.LoadUserProfile = true;
    codeGenProcess.StartInfo.RedirectStandardError = true;
    codeGenProcess.StartInfo.RedirectStandardInput = true;
    codeGenProcess.StartInfo.RedirectStandardOutput = false;
    codeGenProcess.Start();
    foreach (EnvDTE.Process dteProcess in _dte.Debugger.LocalProcesses)
    {
        if (dteProcess.ProcessID == codeGenProcess.Id)
        {
            dteProcess.Attach();
        }
    }
    codeGenProcess.StandardInput.WriteLine("Start");
}

Can a language extension written in Visual Studio Code be used in Visual Studio 2017?


Tag : visual-studio , By : k19k
Date : March 29 2020, 07:55 AM
I hope this helps you . According to the visual studio docs and especially to this picture it should be possible to migrate that language server to visual studio, too.
However it is not possible to use the exact same extension for VS Code as well as for Visual Studio. At least you will have to change the Provider-specific intizialization code (see the picture) to make the server work for Visual Studio, too.

How to get the character to the left of cursor in Visual Studio Extension?


Tag : .net , By : Bart van Bragt
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm trying to get the character on the left of cursor. I've got the handler that intercepts the LineChanged event. , To get the character to the left of the EnvDTE.TextPoint:
string CharacterToTheLeft(EnvDTE.TextPoint p)
{
    EnvDTE.EditPoint editPoint = p.CreateEditPoint();
    editPoint.CharLeft();
    return editPoint.GetText(1);
}
    EnvDTE.TextSelection ts = startPoint.Parent.Selection;
    EnvDTE.EditPoint editPoint = ts.ActivePoint.CreateEditPoint();
Related Posts Related QUESTIONS :
  • Is there a way to refactor all occurrences of a certain line at the same time in VS Code?
  • VsCode Extension: Rename Symbols
  • How to debug Cucumber in Visual Studio Code (VSCode)?
  • Visual Studio Code Does Not Comment-out Empty Lines
  • Drag selected text to move it?
  • How to receive variables autocomplete from all opened tabs in VSCode?
  • Intellisense doesn't find uint8_t and uint16_t in Visual Studio Code
  • How to disable PHP validation in Visual Studio Code?
  • How to repeat a ctrl+ keybinding in vscode
  • How to programmatically show a CompletionList in VS Code?
  • Installing extensions on visual studio code
  • How to autocomplete tag.className in Visual Studio Code like Sublime Text
  • VS Code: How to resize editor window without resizing the whole interface?
  • Start automatically python webserver from visual studio code
  • How to trigger parameter hints in Visual Studio Code?
  • Can you use breakpoints in extension tests?
  • Visual Studio Code files.exclude setting not working
  • How to add keywords (syntax highlighting) to language extension?
  • Get rid of the helper window
  • Is there a way to change the default paths for visualstudiocode?
  • vscode fails to HotReload on latest Flutter version
  • Is there a way to flatten or merge single-folder folders in vs code explorer?
  • VS Code update removed extension
  • How to prevent commands from being displayed if the extension is not active?
  • VSCode IntelliSense does not autocomplete JavaScript DOM events and methods
  • One file has indentention of 2 spaces instead of 4
  • In VSCode intellisense is broken when using @ in import statement
  • How to kill VSCode remote services on Ubuntu Host
  • How do I get the number of ViewColumns the user has open from a VSCode extension?
  • Is it possible to create an extension to vscode that changes the CSS of the editor?
  • VSCode inserting "non-breaking spaces" instead of regular spaces
  • How to collapse sub-folders when a folder is closed in VS Code?
  • I am unable to connect to the extension marketplace of Visual Studio Code
  • Sniff Packets using Charles Proxy and Visual Code
  • Changing the key binding for Command Palette
  • How to disable HTML autocompletion in VSCode?
  • F# with VS Code : Redirecting user input
  • How to fix "Cannot find runtime 'nodemon' on PATH. Make sure to have 'nodemon' installed."?
  • VSCode Rest client - how to set variable to variable
  • Prettier not formatting HTML files in VS Code
  • Is it possible to setup VSCode to show closing tags (or brackets) on the same line as all normal code editors do?
  • How to hide gray boxes where the scrollbar is in VSCode
  • Jupyter notebooks in vscode does not use active virtual environment
  • VSCode nested snippets (or include a snippet inside another snippet)
  • How download all dependency to local using bazel?
  • Copy enable/disable extensions settings to another workspace
  • VS Code - Search for text in all only c++ (.cpp) and header (.h) files in a directory
  • How to Create a Ballerina Integrator project in vscode?
  • Using Rust Cargo TOML variables within VSCode?
  • Is there a way to disable "MDN References Intellisense" popup (for HTML & CSS) in VS Code?
  • Disable hover which show information about the symbol/object in VS Code
  • Vertical column in Visual Studio Code?
  • 'ANY_NODE_APP' is not recognized as an internal or external command, operable program or batch file on windows 10
  • Elm VSCode plugin does not format on save
  • Why was the Santa hat removed from VSCode insider builds?
  • Is it possible to open a C# solution in Rider via the command line?
  • Full Rust setup in VSCode/Atom Issue
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com