Why can't i use palette in netbeans 8.2? - netbeans

I don't really get the function of palette. (IDE Tools -> Palette)
Great tool, works nice in html and php, but in javascript it doesn't let me add anything nor does it show anything i could use.
It is locked or something?

Why can't i use palette in netbeans 8.2?
You can, but probably not in the way that you want, assuming that you want to be able to use the Palette with JavaScript files, because:
The Palette in NetBeans is primarily intended to be used for form development. It is not a general purpose tool for the automatic insertion of code.
The content of the Palette window is context sensitive, and the categories available in the Palette at any time are directly tied to the type of the file currently open in the editor window. For example, the categories available in the Palette for *.html files are different to those for *.jsf files.
Some file types, including JavaScript files (*.js) and Java files (*.java), have no associated categories. Although you can add a new category to the Palette for file types which already have one or more categories, you cannot create a new category in the Palette for a file type with no existing categories. This means that you cannot use the Palette with *.js files.
While NetBeans does not provide a category for JavaScript in the palette, you could add one yourself, but it would have to be tied to one of the file types that are already supported (e.g. *.html or *.jsp, but not *.js). For example, you could:
Create a new category named JavaScript, and add it to the Palette for *.html files.
Add an item named alert to that category which would allow you to insert <script>alert('Hello world!');</script> into *.html files by double clicking that alert entry in the Palette.
It is locked or something?
"locked" isn't the appropriate term since that would imply that you could somehow unlock the functionality, but you can't. At least not through the Palette user interface. NetBeans just doesn't support the use of the Palette with *.js files.
The alternative to using the Palette for JavaScript files is to add your own code templates: Tools > Options > Editor > Code Templates > select Language JavaScript > click New

Related

How to duplicate selected editor in vs code?

I would like the same functionality as for tabs in browser. I didn't find any related extension in marketplace and any command from vs code pallet.
There's nothing that exactly mirrors the "Duplicate" functionality from (for example) Chrome, but you can open the same file side-by-side (or top-and-bottom) in two editors using the "Split" functionality. Right-click on the tab and choose one of the "split" options (each will open the second copy in a different place), or refer to the answer linked below for screenshots and several alternative ways to invoke the "split" command.
How do I open the same file side by side in a single Visual Studio Code session

Associate file type to my vscode extension like a project file

I'd like to do something like a project file. When the user opens it, the webview of my extension would welcome the user instead of the default VSCode editor.
I know I can workaround it by adding extra context menu items or buttons, but in this case I'm curious if it's possible to override that it by default tries to open in the editor.
Is this possible either manually or automatically?
What you're after sounds exactly like what the upcoming webview / custom editor API hopes to accomplish.
The custom editor API aims to allow extensions to create fully customizable read/write editors that are used in place of VS Code's standard text editor for specific resources. These editors will be based on webviews. We will support editors for both binary and text resources.
See the following issue for more info and further links to the proposed API, example extensions etc:
Custom webview editor API (#77131)
Note that it usually takes a while for new APIs to make it into stable releases after being made available as "proposed APIs".

Eclipse - Highlighting same word occurrence of random extension file

Is there any option to make Eclipse highlight same occurrence of word in random extension file?
Eclipse works for known file types (.java, .php, py...), and it matches and highlights same occurrence but it won't match same words in random file types i.e. extension of .abcxyz?
According to the official Eclipse documentation:
To associate editors with various file types in the Workbench:
Open the command link General > Editors > File Associations
preference page.
Select the file type from the File types list, or
click Add to add a type that is not already on the list.
In the Associated editors list, select the editor that you want to
associate with that file type. To add an editor to the list:
a. Click Add. The Editor Selection dialog box opens.
b. Select Internal Editors or External Programs, depending on whether the editor that you want was built for the Workbench or runs
outside the Workbench.
c. If you select External Programs, you can click the Browse button to browse the file system.
d. Select the editor from the list and click OK.
Click on OK to finish associating the editor with the selected file type.
After doing this, Eclipse will be able to properly open files with any custom extension. The tricky part is the highlight thing, i.e., "how to highlight same occurrence of word". For that, you might need to create your custom syntax highlighting rules. According to this question and answer:
The Eclipse framework uses a fairly complex document model to do
syntax coloring (they call it coloring, not highlighting), it is not
as simple as it is in other editors.
If you really want to try and mess with it, you may want to read the
following from the Eclipse plug-in developer guide.
(The above link is now dead. This may be a similar document or this.)

How to make UltraEdit autocomplete class members/functions of C++ class?

I'm currently using UltraEdit, which is armed with Ctags, to edit C++ files (.cpp). Its Ctags support automatically autocompletes symbols while I'm typing—but it can't correctly confine itself to only the members of a class, which is so blind. How to make UltraEdit smarter like Vim+ctags+cppcomplete? So far, I can't find any plugins on web.
UltraEdit doesn't do a great job of auto complete when compared to an IDE like Eclipse etc. because it doesn't know how to parse tokens in a language specific way - i.e. it has no way of knowing what your variable/method names are and listing just those for auto complete.
However, UltraEdit does have a default auto-complete feature built in (control+space) - UltraEdit will search back 50K in the active file from the cursor location for words that match a partially typed word and show these. Go to Advanced > Configuration > Editor > Auto-complete and you can tick the option to "show auto-complete dialog automatically" after X number of chars.
Also, you can set language specific auto-complete files (and UtlraEdit's website has a few predefined ones you can download). So for example you can fill this file with a bunch of class names or other common words/tokens and they will always appear in the auto-complete dialog for that file type too. Link a specific auto-complete file to a file type through preferences:
Advanced > Configuation > Editor > Word Wrap/Tab Settings
Click Change List
Type c or java or whatever the extension is > click Add > click OK
Under the text "select extension for settings or default", select the new extension you just made.
Click "Browse" to link that file type to a specific auto-complete file.
Click OK to exit the Configuration dialog.
Lastly, as of UltraEdit 18, the editor got a lot better with templates. While you have a c file open, display the template view: View > Views/Lists > Template List. You should see in that template list a bunch of smart template for common c structures such as IF, DO etc etc. You can also create your own here too.
Note that all these things (search tokens 50k back in the file; list tokens in the autocomplete file; list templates) will all show up on control+space.

How do I make an editor the default editor for all unknown files in Eclipse?

I regularly open files of different types in Eclipse. For many types, Eclipse uses the system editor by default. I don't want this to happen. I want Eclipse to use the built-in Text Editor for unknown file types. However all I can find are options to set the default editor for a certain file type, but not for all unknown ones. Is there an option to do this?
I don't think you can do this in one swoop, however:
Windows > Preferences > General > Editors > File Association.
If you don't have a LOT of unknown file types, just type *.junk, *.punk, *.clunck and add Text Editor as the default editor.
Sadly you can't use *.* here.
This issue with file associations is something that has always annoyed me with Eclipse. It is specially frustrating if you are trying to use Eclipse to edit files that don't have a file extension because then you can't even set a editor.
I searched over the Eclipse bug database and found my exact issue there. It was first reported in 2003 and up until now there is no solution for it. If you follow the long comment track over the years you will see that there is no way of setting a default editor for unknown file types. From what I gathered the problem boils down to eclipse not looking at the content of file to try to determine the type. Instead it fully depends on the file extension.
Some people have made suggestions for fixes but again nothing has come out of that. If you search the bug tracker DB you will find a lot more bugs created around this.
A clean solution to this is finally implemented in Eclipse.
On the Preferences > General > Editors > File Association page, you can now define an editor selection strategy for unassociated file types.
Source: https://www.eclipse.org/eclipse/news/4.6/platform.php#text-editor-selection-strategy
There is an Eclipse plugin that overrides the default behavior of the platform and opens text file of unknown type in the plain text editor of Eclipse instead in an external editor.
https://github.com/eclipselabs/default-text-editor