Eclipse Mars Javascript验证器在角度服务 [英] Eclipse Mars Javascript validator on Angular services

查看:140
本文介绍了Eclipse Mars Javascript验证器在角度服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse验证器上,关键字finally和catch似乎不允许:



  $ http.get(url).success函数(数据){//处理数据})。error(function(data,status){//处理HTTP错误})。finally(function(){//独立于成功/错误执行逻辑});  



第8行(.finally ...)验证器说语法错误在令牌最后,标识符预期。
如果我删除finally块,错误消失。



有没有办法说eclipse,这不是一个错误,而不会禁用完整的验证? / p>

regards
Bytecounter

解决方案

免责声明 tern.java 的作者。



您的问题来自不支持ES5语法的JSDT验证器。我建议你安装tern.java ,它提供使用JSHint验证JS文件的功能 https://github.com/ angelozerr / tern.java / wiki / Tern-Linter-JSHint ,它能够验证ES5 / ES6语法。



在使用此验证器之前,必须禁用JSDT验证器(请参阅 EcmaScript 6 - 用于Eclipse验证的Tern IDE错误


On Eclipse validator the keywords "finally" and "catch" seems not allowed:

$http.get(url)
.success(function (data) {
    // Handle data
})
.error(function (data, status) {
    // Handle HTTP error
})
.finally(function () {
    // Execute logic independent of success/error
});

On line 8 (.finally...) the validator says "Syntax error on token "finally", Identifier expected". If I remove the finally block, the error disappears.

Is there a way to say eclipse that this is not an error without disabling the complete validation?

regards Bytecounter

解决方案

Disclaimer, I'm the author of tern.java.

Your problem comes from JSDT Validator which doesn't support ES5 syntax. I suggest you that you install tern.java which provides the capability to validate your JS file with JSHint https://github.com/angelozerr/tern.java/wiki/Tern-Linter-JSHint which is able to validate ES5/ES6 syntax.

Before using this validator, you must disable JSDT Validator (see EcmaScript 6 - Tern IDE for Eclipse validation errors)

这篇关于Eclipse Mars Javascript验证器在角度服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆