How can I make a Visual Studio 2017 custom editor refresh the text view? - visual-studio-extensions

I have created a Visual Studio custom editor extension (implementing ITagger<T>). It works perfectly and applies syntax highlighting according to the domain specific language behind it. Nonetheless, when I edit the text, VS re-tags and re-formats only the edited line.
However, when a particular line changes, I need to force re-formatting all the visible lines following the edited line. I do not know how to do this. I tried many alternatives, including responding the Changed event of the TextBuffer behind.
Can you help me with ideas, or sample source code to custom editor implementations that handle this issue? The built-in C# editor does it: when I edit a line, and it becomes a multi-line comment, the text view is changed accordingly.

The extension code Formatter could format the class file and arrange fields, properties and methods as per StyleCop rules. Maybe it is an extension you want to get:
https://marketplace.visualstudio.com/items?itemName=vs-publisher-599079.CodeFormatter

One crude way is to close the document and open it again.
string path = dte.ActiveDocument.FullName;
dte.ActiveDocument.Save();
dte.ActiveDocument.Close();
dte.ItemOperations.OpenFile(path);
Although, I hope there is a better way to deal with this issue.
Edit: Well, I think I found a better way.
An event is declared in your tagger class (which implements ITagger interface). Raising the interface does the job flawlessly.

Related

TornadoFX: Label text not updating

One of the issues I'm currently experiencing is that I can't seem to change the text of a Label which is implemented in a dynamically loaded AnchorPane. I assume this might be related to the controller and how JavaFX/TornadoFX works, but I can't seem to find what I'm doing wrong.
The issue itself occurs in this class, and happens in the showSystemDetails() method. What I would expect to happen is that upon pressing the "System Details" button in the sidebar, the labels would update to the required value, but this isn't happening for some reason.
Please feel free to point me to what I'm doing wrong, or provide any constructive criticism. The project is still in full development so a lot of things are still messy/broken.
The reason this isn't working is that you're manually loading a new version of the FMXL file every time you select something in your menu. The FXML file originally loaded by SystemDetailsViewProxy is updated correctly, but that's not the one you're showing on screen anymore.
To see the updated View, make sure you put the root node of the SystemDetailsViewProxy instance back.
You could for example change your DrawerMenuButton enum to contain references to SystemDetailsViewProxy::class instead of those two strings, and use add(viewClass) to add the correct root node to your view when clicking the menu buttons.
Furthermore, you should be using ViewModels and binding instead of manually updating the text property of the labels. You're doing an awful lot of manual/error prone work that the framework can help you with for free.
Your application is not using best practices in several important areas, and you're rolling your own solutions for stuff that the framework already does very well :)
Views are singletons when managed by the framework, but you instantiate them yourself instead of using inject/find. The result is that important life cycle methods are not being called.
I would also suggest looking into type safe builders instead of FXML.
Hope this helps :)

Dynamics CRM 2015 Creating a button to start a workflow

Hi I am currently trying to follow this guide:
https://ribbonworkbench.uservoice.com/knowledgebase/articles/132235-create-a-workflow-short-cut-ribbon-button-no-code
So that I can create a button on the ribbon in CRM to start a workflow. The idea being that the user will fill in part of the form and then request approval.
However I have ran into an issue which is that at one point I have to define the library for the command actions to use and the guide state that we must use the "/_static/_common/scripts/RibbonActions.js" and the "/_static/_forms/form.js" library.
However not having done this before I have no idea how to include the library in the solution, so nothing appears on the library selection screen. I have tried searching how to complete this step but to no avail. Any help would be greatly appreciated.
Thank you.
What I understood is that you are trying to call a workflow from javascript on click of a ribbon button. If you have any reference javascript assembly then both of them should be referred for the javascript method to work as expected.
Lets assume we have two different javascripts files like reference.js and actual.js And the button is supposed to call a method button_click from actual.js. In such a case we will be adding two commands as follows:
Library:reference.js and FunctionName:isNaN
Library:actual.js and FunctionName:button_click
This way the reference javascript also will be loaded and the method should be working properly. Hope I was able to address your query. Let me know if you have any questions or still the problem persists.
There is a possibility to enter plain text to library field instead of choosing from a selector.

How to find the declaration of a view/action in ASP.NET

I'm new to ASP.NET.
I have a web project in which every View or Action name are underline as you can see in the image (Sorry but it takes at least 10 reputations to post image).
Image
It contains 2 declarations, the first one is the default: ViewResult Controller.View().. like normal. And the second one is the View file or the action that it refers to.
When you use Go to Declaration command, it'll bring you to that file or that action. That's what I want, but I don't know how to get it. I have Resharper installed and using Visual studio 2013. I have tried to create new project but it just show only the default declaration. I get this project from a private source and the one who give me have no idea about it.
Please help me if you know. Thank you very much.
If you are using Resharper then just Right click On underlined text and select Go to Declaration or Go to Implementation. It will take to you view file.
I hope it helps you.
I don't know why but changing the default library System.Web.MVC from version 5.1.0.0 to version 4.0.0.0 have enabled that feature for me. But it'll need to change other references to downgrade the whole project to version 4.

Disable auto-close HTML tagging in FreeTextBox for ASP.NET

Recently I have run into a bit of a problem with FreeTextBox for ASP.NET. Every time I open a HTML tag in the HTML editor view, if I switch to the design view and come back the tag is automatically closed. This happens when pasting text into the box as well. This is a real problem, I don't want the tag to close automatically, is there any method that can be used to stop this I have looked through the documentation but can't find anything to prevent auto-closing tags.
I'm sorry to tell you that, sometime, the answer is "No, you can't do that".
The only way can I see to do this is by altering the source code. There's a Distribution License that allow you download and modify the code to fit your needs, but there is no easy way out.

CodeCharge Application

I need to make small asp.net application in codecharge.
Please tell me how to add server side event into that app and how can i get textbox value in server side.
Have you had a look through the examples here:
http://examples.codecharge.com/
This is going to sound like 'RTFM' but... the Help file that comes with Codecharge is quite extensive and goes through many of the common tasks (in the case of CodeCharge Studio (CCS), it does it for each language - PHP, .NET, perl, JSP, coldfusion, ASP). See the links below for the online version.
An example of using the Server Side events (Before Insert) to modify a control's value is shown in all languages (see 'Replace Control Value Before Inserting' and choose your project's language at top-right of page).
As with most frameworks, a lot of the gathering of POST values from controls are already done and ready to use at run-time. CCS has lists of the properties and methods of its 'components' in the Help as well. Most languages have something like 'GetValue()' in their run-time properties - check the Text Box Component Reference section of the Help. For .NET it's 'GetFormattedValue()'
CCS also has a lot of pre-built 'Actions' to use in the Events - so in a lot of cases you don't need to code it yourself, there may be an Action to Help. You can also choose an Action, get CCS to make it, double-click on the Action, and view the generated code for tips. You could then delete the Action (don't delete the code, delete the Action and let CCS remove the actual code) and you can then add 'Custom Code' and put in your own. I have used that method when learning a new language in CCS.
You use within an event on the server.
Login1.GetControl<InMotion.Web.Controls.MTTextBox>("login").Text

Resources