When I do something like this in a a Writecommand action,
editor.getDocument().insertString(offset, "Sample text");
I guess it is stored in cache and is not updated immediately.
So what can be done to get the update in the very immediate line.
I tried refreshing the Virtualfile synchronisely and asynchronisely, but didnt help.
So what can be done?
To update the file on disk, use FileDocumentManager.saveDocument(). To update the PSI for the document, use PsiDocumentManager.commitDocument().
Related
In VS Code there is a plugin called GitLens which allows the user to click on a line a view the last authors and changes of that line. It also allows viewing file changes from page commits. Is there an equivalent for Intellij?
GitToolBox is probably the closest, the inline git blame is nice.
It is called Annotate with Git Blame and you can find in with contextmenu on the linenumbers or as an Action with Ctrl-Shift-A.
GitLink plugin does the same job
https://plugins.jetbrains.com/plugin/8183-gitlink
I really like how Hyperlinq allows you to hyperlinq to a website, but what about to a file? I would like to do something like this:
new Hyperlinq(#"C:\temp\afile.txt");
This is a bug in LINQPad - I've fixed it for the next build.
I have tried
new Hyperlinq(new Uri(#"C:\temp\afile.txt").ToString());
With this you get a valid hyperlink but I failed to click on it to open the file.
If you paste the link into a browser it works. I don't know if its a limitation of LinqPad.
Is it possible to wrap long comment lines in IntelliJ in javascript files? I have turned on line wrapping as shown in the settings below, but when I do a code reformat, it doesn't wrap the line.
It's not supported yet on code reformatting, added a new feature request, please vote.
I'm using IntelliJ 14 on a Mac, which has a Fill Paragraph command. Access it via the awesome universal Command-Shift-A action search feature. Works like a charm!
Getting "file x.java is too large for IntelliJ Idea editor" after trying to open a web service stub class that is generated for Axis 2.
I saw a post associated about this issue which says change the
idea.max.intellisense.filesize=2500
in idea.properties.
But this trick didn't work for me despite I increased the value enough. Also I tried to comment out it for disabling this feature; but it didn't work too..
Nowadays the setting
idea.max.intellisense.filesize=50000
works perfectly for me and lets me open files of up to 50M size.
If you just want IntelliJ to open the full file instead of truncating it, use this:
idea.max.content.load.filesize=500000 #500MB
My issue is that the file was > 20mb. See this link: http://youtrack.jetbrains.com/issue/IDEA-85045
I'm writing an Eclipse plugin with a wizard (org.eclipse.jface.wizard.Wizard) which creates a new file with a basic code template. To simplify the "piecing together" of the file contents, I plan to stuff everything into one long string, inject it into the file, and then call my custom Formatter (inherits org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter) to clean up all the indentation and so on.
Question is, how do I go about calling the formatter programmatically?
In the wizard I call IDE.openEditor() and get back a handle to an IEditorPart. What can I do from here?
Well, I have found my answer:
IEditorPart editor = IDE.openEditor(page, file, true);
XtextEditor xed = (XtextEditor)editor;
((SourceViewer)xed.getInternalSourceViewer()).doOperation(ISourceViewer.FORMAT);
Maybe that will help someone else looking for something similar!