Code folding in Netbeans for javascript - javascript

I just recently started using Netbeans, and i have been working with javascript files, the files are becoming large, and i want the ability to group function in something like this in visual studio, actually code folding.
#region
code goes here
#endregion
After a search i found out that you could use
//<editor-fold>
</editor-fold>
http://wiki.netbeans.org/FaqCustomCodeFolds
but this does not work with .js files, as it's treated like a comment.
Please advise, how to add custom code folding in Netbean on javascript files.

Currently the custom code folding is not supported on javascript files to the current editor.
But will soon be implemented in the new editor in the official distribution of netbeans,
That allows you to edit your javascript files, with all features currently available in other programming languages.
New JavaScript Editor
But if you can not wait more, then you can download the Develoment Version of NetBeans
Implementing the new editor, without losing your current project settings.
Also you will can create your template code, for make a surround block code. Explained in this link.
And this is the new editor in test

Related

Eclipse for PHP Developers - Javascript Content Assist and Tasks Not Working

I'm using Eclipse IDE for PHP Developers Version 2020-03 (4.15.0) on Windows 10 Home, 64-bit.
When I create a JavaScript project (or create a PHP project and convert it to a JavaScript project) and edit a .js file or type JavaScript code between tags in an .html file, Content Assist is not giving any suggestions for built-in JavaScript objects or methods, and task tags (like TODO) are not showing in the Tasks view.
Content Assist will suggest functions, variables, objects, and methods created in whatever .js file is currently being edited, but it won't suggest any built-in JavaScript objects or methods unless they've already been used in the file (in which case it treats them as user-defined). ECMAScript Built-In Library, JavaScript Web Project Support, and ECMA 3 Browser Support Library are all included in the project's JavaScript Include Path. I can expand the Libraries under "JavaScript Resources" in the project tree and double-click on any of the entries to open the .js files that contain the definitions for the built-in objects and methods, but Content Assist doesn't suggest any of them when I type and press ctrl+space.
The Tasks view shows task tags in .php, .css, and .html files, but not in .js files. If I add a task tag in a .js file (like "/TODO Fix this/") the tag is highlighted correctly (syntax highlighting in .js files works), but it doesn't register as a task (the task icon doesn't appear in the gutter to the left of the line number the way it does in .html, .css, and .php files).
I've been searching for solutions for hours but everything I find either doesn't work, says to change a setting that's already set correctly, or doesn't apply to this version of Eclipse.
I tried using an older version of Eclipse (Oxygen.3a) and it does exactly the same thing, so I'm assuming I'm doing something wrong?
EDIT: Some answers for older versions of Eclipse that I wasn't able to find on my own showed up after I posted this (such as Eclipse: Content Assist not showing suggestions). I tried downloading an even older version of Eclipse, Mars.2, and everything is working correctly in that version. Are the issues in Eclipse 2020.3 just "bugs"?

How do I build AlphaTab?

I am trying to build + make changes to AlphaTab, a tablature reader that can be displayed on the web using SVG. It is a Visual Studio solution, but I cannot figure out how to build it successfully (I also have little experience with VS). I am using Visual Studio 2017 Enterprise, which I have access to as a student.
There are multiple projects within the solution, but the build I want is the JavaScript file. I know that it first compiles to Haxe and then to JavaScript, first using Phase, a C# -> Haxe compiler, which was also written by the AlphaTab creator.
Unfortunately this is all the info I have.. there aren't build instructions on the repo and I tried to reach out on his Contact page. I really like the look + simplicity of using AlphaTab and want to add some changes, but also if there are other open source tab editors (display on browser) that look as nice, please link if possible!
There is an unmaintained haxe version of alphatab on the haxe branch of the main repo, did you try experimenting with that?
https://github.com/CoderLine/alphaTab/tree/Haxe
open the .hxproj file in HaxeDevelop
https://haxedevelop.org/
Or in Visual Studio Code
https://github.com/vshaxe/vshaxe
To see if it has enough features try the html in the bin folder.

How to add Javascript file into Eclipse?

I am using Eclipse Oxygen.
I have web features already installed, I think some packages are missing for javascript files.
When I try to create a new javascript file, I see that there is no javascript file. How to add this feature into eclipse?
screenshot:
You just look in the wrong "folder" ("Web") to create a new JavaScript-file, the proper path is "JavaScript > JavaScript Source File".
You can also take advantage of the search in the Wizards when you type the desired search term at type filter text.
You must be using a perspective, which is not suitable for web development.
Try opening a perspective which suits your development domain. Web and Java EE perspectives for example supports JavaScript development. If such is not available in you Eclipse installation, you have to install additional tools. Which Eclipse package are you using?
In the right perspective you will have the JavaScript Source File option in the New pop-up dialog right clicking your project or an appropriate project folder (eg. WebContent).

How can I add autocomplete in notepad++ for javascript in an .html file?

Notepad++ does auto-complete for html and also for JavaScript. but the auto-completion depends on file extension.html file supports completion for html only. Is there a way to enable auto-completion for javascript in the script tag of an html file? I mean, other than copying the auto-completion keyword list from "javascript.xml" to "html.xml" files...
You would either need to
write your own lexer plugin (may possibly have an issue of conflicting with the internal HTML lexer), or
modify the source and compile your own notepad++/Scilexer.dll
Both are not quick undertakings.
I was faced with the same dilemma. For me, The most simple way to get the functionality you desire was to switch to an editor that already does this by default called Brackets. It is specifically designed for web development and is completely free and lightweight.
Another way to do is to create 2 files and code
JavaScript in the second one (but never save it)
HTML in the first one (and copy/paste your Javascript between <script> </script> balises)
Best way to work (for security) is to use 2 separated files : your JavaScript could be protected when the user try show source-code in his browser.
by the way, Notepad++ is a very fast and smart editor, you could just add complements to it like JSLint, emmet, nppFTP, indent by fold... and change it theme by a dark one (Obsidian) : it would be enough for small projects coding. ;)

grails development: eclipse vs. intellij idea

I downloaded sts and installed the grails/groovy plugins which is fine, but I can not use the JavaScript functionality like jumping through classes and functions in the JavaScript editor.
When I click command and on the functions name, I get a dialog saying "you have to make this a JavaScript project etc." :( :(
intellij is much better at this I think, but it takes all my cpu usage which is really sad :( so I need to switch to eclipse...
My question is: Why can't I use the JavaScript editor plugin from eclipse when my project is a "grails project"?
Eclipse's JavaScript editor is part of the Eclipse Web Tools Project (WTP). Thus, it's shipped with SpringSource Tools Suite (STS).
In new STS Grails projects as created by the Grails project creation wizard, however, the JavaScript project facet is not enabled by default.
To enable it,
right-click on the project root in the Project View,
select Properties,
in the Properties dialog, select Project Facets,
click Convert to faceted form...,
mark the JavaScript checkbox,
and click OK.
After that,
there will be a new top-level item JavaScript Resources (where you can browse the sources of ECMA and third-party JavaScript files),
and there'll be code inspection and completion in HTML <script> tags
and JavaScript source files (file extension: .js),
including for third-party libraries.

Categories