everlaw / nbts Goto Github PK
View Code? Open in Web Editor NEWNetBeans TypeScript editor plugin
NetBeans TypeScript editor plugin
I got the error: File "node.d.ts" not found when I use: ///
I know why this happens, because I don't have the node.d.ts file atm, but I think it should be possible to add all node typedefinitions into the plugin or is it more a feature request for the node implementation for netbeans, to add it there? What do you think.
When clicking on Tools -> Options (or Preferences) and selecting Editor -> Code Templates, there is no TypeScript option.
In /tsconfig.json
, I have
{
"compilerOptions": {
"experimentalDecorators": true,
but I'm still getting the error "Experimental support for decorators is a feature ... " etc.
I haven't found other place to put this option to, hence filling this as it seems not to work.
I am tryning function to go declartaion and find uasage but it is not working.
Hello,
is it possible to support Tslint in order to display errors or warnings when a rule is broken ? It would be nice if Netbeans can support this feature.
Reported by an exception reporter as https://netbeans.org/bugzilla/show_bug.cgi?id=262524
Hi,
I have a little problem with the compilation onsave and UTF-8 files. For example, with a simple test.ts:
let test = "Déjà-vu";
The compiled file test.js was badly encoded:
var test = "Déjà -vu";
//# sourceMappingURL=test.js.map
I do not have this problem with a command line compilation.
Hi, i have installed plugin to develop with typescript, it's all ok, i can compile in js, i can debug, etc..
But in typescript file the ide give me a error, and i don't understand why, can you help me?
I can run the application without problem, but why i have this error!?!?!
thanks
the error image:
https://dl.dropboxusercontent.com/u/3159474/typescript.jpg
In Java you have a feature when you have this:
class Test extends BaseTest implements ITest {
}
if you haven't import the right package for BaseTest or ITest yet, you can hit Alt + Enter and you got the hint functionality "Add package: org.foo.bar.BaseTest."
This feature would be very handy for TypeScript too, that he can find any module where ITest and BaseTest is declared or exported and show the hint which import you want to use.
Cheers
Chris
Refactoring currently doesn't work. Would be another great feature to have. Rename etc.
It would be helpful for the README to have a simple Build section to allow collaborators to get up and running more quickly, and to give end users the opportunity to use master
with minimal fuss.
It would be great to have debugging capability right in NetBeans.
I really would like to contribute, but atm, I don't have enough time to do so. But it should be not a big deal to bring all options from the tsc compiler to the TSProjectCustomizer and to save it to a project specific tsconig.json file.
So that I can check/uncheck noEmitOnError or set/change the target version between es3, es5 and es6.
Regards
Chris
Since the above is a special comment, I think a nice to have and probably easy change is to have a special coloring that is not a comment for this.
Hey, as you can see it here, he is still working on such thing too: https://github.com/GeertjanWielenga/TypeScript please connect together or give them as a pull request to the repo or whatever.
In a js file for node, I have:
var properties = require('');
and when I hit ctrl + space inside '' I got the code completion to find default packages like fs or ./myPackage. In my case I added a npm package called properties to interact with property files. In node everything is fine, I have the code completion but in a ts file, there is no code completion to find packages. This is a must have in my opinion to find certain packages after hitting ctrl + space.
Regards
Chris
I have started using this plugin for my ES projects with babel.
It would be great if this plugin supported adding of file extensions more than just ".ts".
I tried just creating a new one through Tools --> Options --> Files with "text/typescript" as MIME.
Syntax highlightning works but I get an alert at top of the editor window that states the following
"File {src/main.es} is not in project defined by tsconfig.json".
But if i rename it to ".ts" no alert message is shown.
Is there a workaround in tsconfig.json or is this a plugin issue?
Hello,
JavaScript and JSON codes are very pretty when using the Netbeans theme Darcula as you can see.
However, TypeScript code is not very pretty when using the theme Darcula. For example methods of classes are displayed in black and some identifiers are displayed in purple and it's difficult to read them.
Is it possible to improve colours displayed in TypeScript files when using Darcula theme ?
File index.ts:
import {Foo} from "Foo"
var test = new Foo();
File Foo.ts
export class Foo{
}
project:
ModuleError.zip
When I create a typescript file, netbeans shows an error that says "Error creating Node.js process. Make sure the "nodejs" or "node" executables are in stalled and in your PATH." I do have node in my path and I am able to run Javascript files as node modules within netbeans using a node plugin. Here is my .bashrc:
echo prefix = ~/.node >> ~/.npmrc
export PATH=/usr/local/bin/.node/bin:$PATH
export PATH=/usr/local/bin/.node/lib:$PATH
export PATH=$PATH:/usr/local/bin
A sample TypeScript project can be under New Project -> Sample ...
Geertjan has implemented a sample project and File Template for TS.
These could reasonably easily be adapted to fit in your project.
Please let me know if/why (not?) I should add this feature here.
In my options, ts files are set to a MIME-type called "text/qttranslation+xml". This is the default, apparently, as you can see by the "Default" button being grayed out:
Attempting to open any .ts files with this MIME-type set just makes nothing happen. Also, the icon the files have is weird:
I've looked through the list of MIME-types presented to me; none of them seem to have anything to do with TypeScript. If I override the default MIME-type with "text/javascript", I can open the files, but they're clearly being treated as regular Javascript files if I do that. Which MIME-type should I set to get the TypeScript editor to work?
When I type this:
import * as IEnumerable from ', I expected that when I type ' that the code completion for the modules/files comes up but there isn't any code completion for this.
It should shows me the available modules maybe from the namespace/folder or whatever and when I type ./ all in this folder or ../ in the parent folder and so on. WebStorm shows me all available modules inside the folder or from the namespace I don't know. And it works for ../ as expected and mentioned from me.
Regards
Chris
Code Templates may be a good addition to your projects and should be near trivial to implement. I would be happy to do that. At the moment the code templates are just copied from JavaScript, but I could "typify" them. I added one for arrow functions or anonymous functions like so already in our project:
arr<tab>
// results in
($parameters) => {
$cursor
}
When creating an interface or an abstract class, it would be great if one could click the hint and implement all abstract methods which throw an Error like they throw an exception in Java.
When I'm in the first line and hit "i" I expect that the first item what will be found is import, but I got a list of lots of other stuff, started by innerHeight, innerWidth, indexedDB etc, pp. In WebStorm you can see a better behaviour. It shows you a lot of more stuff too but the first item is always import, because of the context. The same should happen for module, export, extends, implements, class, private, public. etc. Because in this context, no other stuff make sense.
Regards
Chris
Ok, I can create it from sources, but I know, you already have it. Why don't you publish it? Or at least single .jar file?
It would be great if the compilation could be triggered by external changes, especially
When a TS file is saved, it would be convenient if the user had the ability to automatically compile *.ts files. This could be a project wide and/or IDE wide setting as well.
Geertjan already did something like this that could be adapted and improved to fit better into this project.
I just installed the plugin on Mac OS X and this is the error I get:
I found no options in NetBeans to specify the path to my NodeJS executable and I have installed NodeJS with the standard installer, the executable's path is /usr/local/bin/node
I managed to run an echo $PATH from NetBeans and this is what I got:
/usr/bin:/bin:/usr/sbin:/sbin
The installation instructions call for a netbeanstypescript.nbm but I don't see that in the zip i downloaded.
If a war is deployed and a js file gets created/modified by the compile-on-save-functionality, the newly created/modified file doesn't get deployed.
The reason is the js file gets created by the means of nio. When creating/modifying the file by the means of FileObject, netbeans is aware of the change and deploys the new js file.
I created the following patch for TSIndexerFactory:
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -38,7 +38,7 @@
package netbeanstypescript;
import java.io.IOException;
-import java.io.Writer;
+import java.io.OutputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -155,10 +155,23 @@
System.out.println("Writing " + p);
try {
Files.createDirectories(p.getParent());
- try (Writer w = Files.newBufferedWriter(p, StandardCharsets.UTF_8)) {
- if (writeBOM) w.write('\uFEFF');
- w.write(text);
+ String jsFilename = name.substring(name.lastIndexOf("/") + 1).replaceAll("ts$", "js");
+ OutputStream os= null;
+ FileObject o = fileObject.getParent().getFileObject(jsFilename);
+ if (o != null) {
+ os = o.getOutputStream();
+ } else {
+ os = fileObject.getParent().createAndOpen(jsFilename);
}
+ try {
+ if (writeBOM) {
+ os.write('\uFEFF');
+ }
+ os.write(text.getBytes(StandardCharsets.UTF_8));
+
+ } finally {
+ os.close();
+ }
} catch (IOException e) {
String error = "Compile on save: could not write file " + name + "\n" + e;
DialogDisplayer.getDefault().notify(
At the moment, every time I check out the project, I have to manually add a couple of module dependencies. It would be good if that were not the case. It is a manual process that is annoying. I believe that just a few minor changes to the nbproject folder solves this issue.
I will make a pull request to fix this problem if it does.
But I've set "module":"commonjs" in tsconfig.json, and no error when run tsc in command line.
TypeScript Services provides classifications that can be used for syntactic and semantic classifications. With any new features coming in, it would be less work for you if you managed to get things wired up and utilize that.
I use the newest npts version 1.8.10.0 and when add a new File via selecting the project, right click and go to new -> Typescript file, I got an NPE after creating and automatically opening the file.
java.lang.NullPointerException
at netbeanstypescript.TSService.updateFile(TSService.java:412)
at netbeanstypescript.TSParser.parse(TSParser.java:60)
at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:621)
at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:251)
at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:138)
at org.netbeans.modules.csl.core.GsfReformatTask$1.run(GsfReformatTask.java:102)
at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:609)
at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:153)
at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:137)
at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:204)
at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:201)
at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:141)
at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:88)
at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:201)
Caused: org.netbeans.modules.parsing.spi.ParseException
at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:209)
at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:104)
[catch] at org.netbeans.modules.csl.core.GsfReformatTask.reformat(GsfReformatTask.java:95)
at org.netbeans.modules.editor.indent.TaskHandler$MimeItem.runTask(TaskHandler.java:557)
at org.netbeans.modules.editor.indent.TaskHandler.runTasks(TaskHandler.java:316)
at org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:365)
at org.netbeans.modules.editor.indent.api.Reformat.reformat(Reformat.java:154)
at org.netbeans.modules.editor.indent.IndentScriptEngineHack.eval(IndentScriptEngineHack.java:96)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at org.netbeans.modules.editor.indent.IndentScriptEngineHack.eval(IndentScriptEngineHack.java:125)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.createFromTemplate(ScriptingCreateFromTemplateHandler.java:133)
at org.netbeans.api.templates.CreateFromTemplateImpl.build(CreateFromTemplateImpl.java:121)
at org.netbeans.api.templates.CreateFromTemplateImpl.build(CreateFromTemplateImpl.java:92)
at org.netbeans.api.templates.FileBuilder.build(FileBuilder.java:250)
at org.netbeans.api.templates.FileBuilder.createFromTemplate(FileBuilder.java:351)
at org.openide.loaders.MultiDataObject.handleCreateFromTemplate(MultiDataObject.java:878)
at org.netbeans.modules.csl.core.GsfDataObject.handleCreateFromTemplate(GsfDataObject.java:160)
at org.openide.loaders.DataObject$CreateAction.run(DataObject.java:1597)
at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:261)
at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127)
at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:519)
at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:286)
at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:1051)
at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:983)
at org.openide.loaders.TemplateWizard$DefaultIterator.instantiate(TemplateWizard.java:919)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:605)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:439)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:160)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1629)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1570)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:92)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2257)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Support plugin in projects "Java Web" -> "Web Application"
We are using TypeScript in NetBeans with Oracle JET.
It mostly works fine for us with this NetBeans plugin.
It automatically compiles our ts files to js. However, I don't see any console about compilation errors.
If I start tsc -w in a separate console then I do see the log messages. But that means the compilation starts from both NetBeans and console.
How can I fix this?
Thanks,
Peter
Hello,
In netbeans 8.1 we can have a full auto-completion in JS when we begin to type a keyword or a variable for example (To enable it, we have to go to Tools > Options > Editor > Code Completion > Chose JavaScript in Language drop-down list and then in the section "Enable Auto Popup completion windows for" we check "All possible situations".
However on using TypeScript with this plug-in we only have an auto-completion for method and attribute after typing a ".".
Is it possible to have the same option for full auto-completion like we have in JavaScript ?
I think with the full-completion available, netbeans will become one of the best IDE for TypeScript. :)
Currently TypeScript plugin assumes that TypeScript projects correspond to NetBeans project source roots which I think is usually src/main/java
for jar
Maven project and also src/main/webapp
for war
project. These source roots can have tsconfig.json
.
But usually my TypeScript project corresponds to Maven project, I have tsconfig.json
in the same directory as pom.xml
. Currently this project structure is not supported and tsconfig.json
is ignored.
I am using Ubuntu 16.04 & Netbeans-8.1.
I have installed typescript plugin v1.8.10.1 but TS function navigator is not working.
Can you fix this?
It would be great if the compile on save option also create sourcemap's for the browsers (-sourcemap argument when invoking tsc from command line).
Hi!
Any possibility to specify the location of the tsd.json or the typing directory?
When I have the typings directory outside of the Site Root, I lose all reference of the external definitions types.
Using NetBeans IDE, Version Dev (Build 201607090002), I have problems with the goto-declaration feature of the plugin (nbts Version 1.8.10.1, probably related to #47)
Steps to reproduce:
npm install && npm run start
start
processdist
foldersrc
foldere2e
folderNow, when you open the src/app/app.component.ts file, you can jump for example into the '@angular/core' file as expected.
However, if you close NetBeans and then reopen it, this goto-declaration will not work anymore.
Closing and reopening the project won't help, and never got it to working again
Project is a simple angular-cli project (angular-cli: 1.0.0-beta.9)
I have this piece of code:
import * as IEnumerable from 'IEnumerable'
in my file, which is located in folder System -> Collections -> Generic and is called List.ts.
IEnumerable.ts is located inside System -> Collections -> Generic -> Interfaces.
Webstorm can find this module, the netbeans plugin not. It is red and shows me the message: Cannot find module 'IEnumerable'.
Regards
Chris
I'm not sure if this is a Netbeans bug or if this is something the plugin should / could handle. In some languages (eg Java), Netbeans offers the possibility to add code regions, with the tag. For example:
// <editor-fold desc="GUI events">
... some code
// </editor-fold>
Then this code region can be folded (like functions can). But this doesn't work with nbts. Can you tell me if this is the plugin's role to handle that, or if I have to fill a bug to the Netbeans team? Thanks!
Hi,
Thanks for this plugin. I'm trying to use it on an Angular2 project, and it makes Netbeans hangs (from 1sec to several minutes) every time I save a file. Seems like the plugin is ignoring the "exclude" directive of my tsconfig.json, which would make the plugin analysing the 50Mo or so JS files contained in my node_modules folder.
Here is my project architecture (I created a Maven project):
src
pom.xml
And here is my tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules"
]
}
Is everything correct? Or must I change something? It would really be great to have project templates (#6).
Note: if I put the "node_modules" folder at the root of the project, the problem seems gone, but Netbeans shows an error at the line:
import { Component, View, bootstrap } from 'angular2/angular2';
Saying "Cannot find module 'angular2/angular2'"
Thanks!
Hi
After installing and having a working plugin, for some reason, now whenever I start the IDE I get a code error, with a message "Error in getDiagnostics" showing next to the first line, for any typescript file.
I have tried installing a newer developer version of Netbeans, and removing and installing the plugin again, but have lost all the functionality of the plugin beyond basic file creation tools
The plugin was working (albeit a little bit slow to update errors when fixing causes) but after a few days it completely stopped.
A restart also didn't fix the issue
Using Netbeans IDE 8.1 on Windows 10 x64
I'm working on an Aurelia app. Structure (simplified) is like this:
root
| - test
| - unit
| - e2e
| - src
| - tsconfig.json
My src files are compiled build-time, but the test files are transpiled on-the-fly by karma during test runs, so they're on the exclude
list in my tsconfig.json
. However, I still want autocompletion and syntax errors in my test files. But it seems that the plugin picks up that the test files are excluded from tsconfig.json
and does nothing with the file, giving this error instead:
File test/unit/my-class.spec.ts is not in project defined by tsconfig.json
Is there a way around this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.