how to write notepad++ auto-complete plugin - plugins

I'm trying to develop a small plugin that will do a sort-of auto-completion along with some other advanced features in order to create a primitive IDE to use with a custom scripting language we've developed.
So I want to know, how do the auto-complete plugins usually work? I have a basic plugin template that I'm playing around with (the C# one) and I see how the commands work, from a high level anyway, but I'm trying to figure out how I would create my auto-complete feature.
My first guess would be to make a command that spawned a new thread that retrieved the entire contents of the notepad++ text every 100 mills or so and then popped-up a little selector box or directly wrote the auto-complete possibilities when the correct pattern was matched on the newly typed text.
Any wisdom from those who have gone before me on this?
Thanks alot.

Well I figured it out. Apparently there is a "beNotified" method in my project template that I downloaded and it handles all events/notifications from the Scintilla/Notepad++ environment. I will probably be using the SCN_CHARADDED event to check the current line of text each time a character is added to the GUI.

Related

How to create a Notepad++ macro to run multiple plugins automatically?

I am using Notepad++ for different languages i.e: JAVA, C, C++. For each of these languages I have installed plugins to make coding easier in Notepad++.
The problem is that every time I start Notepad++ I have to go and run all those plugins manually. I tried recording a macro so that it will perform all these actions by one click but it didn't record anything I did with the plugins. The macro will record any changes I bring to the code or if I save the code to some other location but it won't record the actions performed by the plugins.
Can anyone guide me to a solutions.
Thank you in advance.
Have a look at AutoHotKey tool. It can send keystrokes/mouseclicks to Notepad++ so you can easily combine invoking many menu items into one command. (And much more like work with clipboard, ask for values in input boxes, run apps or DLL's.) Please see AutoHotKey usage with Notepad++ in this answer.

Run eclipse editor action on entire project

Question:
Is there a way to run an eclipse action that is available from the context menu in the editor on every file of an project.
Actual Case:
I have to work with the leon3 and my dull mind has trouble enough understanding the code, that I do not want to scan lines to see if there is a semicolon hidden in there to see if there are multiple instructions or if the end if happens to be behind another instruction rather than on a line of its own (I missed an end if, which caused me to think that statements were conditional,...), therefore I would like to format the source nicely. I have access to Sigasi PRO which offers the option to "beautify" code as an operation in the editor. I would like to run this operation on all files in the leon project automatically.
Sigasi indeed only offers formatting in the editor at this time. In the Sigasi editor, you can format a selection or the entire editor's content. But, you can not trigger the formatting action without an editor.
I have not tried this, but I think you can achieve this with the Eclipse EASE project. EASE is a scripting environment for Eclipse.

Is there a way to create templates for text files in Eclipse?

In Eclipse, I really enjoy being able to create templates for things I commonly write in Java and XML. While there is some room for improvement, templates have proven to be quite the time saver. Today I was documenting some notes in the release notes. We have a specific format that we write said release notes in. I thought it would be handy to write a small template so that I could easily insert most of the boiler plate text when I amend the notes. So I dug around the eclipse settings and didn't see anything for plain text files. I googled around and also didn't see anything.
So is what I'm wanting to do possible in Eclipse? Is there a plugin I would need to enable such a feature?
I assume the closest you can get is using Snippets
Add the view by clicking Window -> Show View -> Snippets. In that view, right-click and select Customizeto create custom snippets. You can now add those snippets in your textfile by double-clicking them.
Maybe there is also some shortcut feature I didn't find yet...

Automated function hints tool in Matlab

I have worked shortly with Netbeans using Java and use eclipse for school projects, where I noticed there are some really cool features like it will show built-in functions on ctrl-space or it will suggest from existing variables. I recently started using matlab, I was wondering if there are any such tools available in the matlab. I know it's a scripting environment so things are probably a little different but then I wonder people who work with extensive projects with matlab, how would they manage the codes or cross-develop without such tools. I searched mathworks but could not find any useful information on that.
Anyone knows if such tools or add-ons existe for matlab? Thanks in advance guys!
As mentioned before, autocomplete works for functions, variables and fields.
If it seems to fail to work for a field (perhaps because your workspace is not properly set up) it can help to call the field without index:
For example:
entity.field instead of entity(i).field
Also if you change the workspace frequently it may be that the mfile editor does not catch up, in that case a quick workaround is to just type in the command window and copy afterwards.
As mentioned before the variables need to be in workspace.
I often approach so that I evaluate the code as I write it like this:
Write the code in cell mode
Evaluate cell with [ctrl - enter] - or button in menu bar.
Write next cell (variables of previous blocks are now available in workplace, autocomplete with tab)
There is also a matlab mode for emacs. It offers some autocomplete functionality and has a nice feature to wrap long code lines.
unfortunately on windows it lacks the ability to evaluate cells. So I rarely use it.
There are some similar design in MATLAB, one of them is called function hints.
You could find the documentation for it in here: http://www.mathworks.com/help/matlab/matlab_env/check-syntax-as-you-type.html

How does Eclipse do code completion specific to third-party frameworks?

How does the Eclipse editor work to enable code completion? For example, within the XML editor for Hibernate property files, if I ctrl-space within a tag, a list of possible value relevant to hibernate will show up.
I understand that the XML editor is pre-configured to understand xml tag, but how about tag specific to a particular framework? How does Eclipse know about that?
I believe that the eclipse XML editor gets the content assist information from any referenced DTDs, or XMLSchema information it associates with the XML file. Try this experiment: Remove the DOCTYPE entry at the beginning of the file and see if content assist still works.
If you're interested in writing your own content assistants, you may want to start by reading the following:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_contentassist.htm
In a nutshell, like most things in Eclipse, this is a platform hook. When you press the button, it queries all the registered assistants (I'm simplifying here), and they provide suggestions based on the current element or even the current content.
When writing a source editor or viewer for a particular language or document type, it is common to provide at least some rudimentary content assistants.
Removed the DOCTYPE entry at the beginning of the file and im now able to see the commands while typing ctrl+space...
To add to Uri's answer, you can define your own editor for your own language with XText as long as you have a simple EBNF grammar language for your DSL (domain specific language).
You will have:
syntax coloring,
model navigation (F3, etc.),
code completion,
outline view, and
code templates.
Here is a solution you can work. Actually I was facing a same problem with struts.xml file. I was not able to produce tags by cntrl+space
what i did was...
go to Preferences...Java...Editor...Content Assist...Advanced
check all the check-boxes ON and press OK.
sometimes the problem persists due to some false alarming in eclipse. If it happens, just delete your xml file and create a new one in same location.
I hope it will help.
I had the same issue while using the struts.xml file.
I got fix when I tried below...
Go to “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Java Non Types Proposals” are ticked on both the places as shown in the image below then click Apply and OK button:-