Android Studio 的 JavaScript 功能

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33783195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 16:54:00  来源:igfitidea点击:

JavaScript functionality for Android Studio

javascriptandroid-studiointellij-ideaautocompletehybrid-mobile-app

提问by Niklas

See edit below.

请参阅下面的编辑。

I want to add code completion and syntax highlighting for a custom JavaScript library in Android Studio so I can develop my hybrid app within one IDE without switching all the time.

我想为 Android Studio 中的自定义 JavaScript 库添加代码完成和语法突出显示,以便我可以在一个 IDE 中开发我的混合应用程序,而无需一直切换。

The problem is: Android Studio is based on IntelliJ IDEA Community Edition. Therefore it does not support JavaScript out of the box as this is a feature of their Ultimate Edition. So far I haven't found any plugin yet to support the most basic JavaScript neither in Android Studio nor in IntelliJ IDEA CE.

问题是:Android Studio 是基于 IntelliJ IDEA 社区版的。因此,它不支持开箱即用的 JavaScript,因为这是他们 Ultimate Edition 的一个功能。到目前为止,我还没有在 Android Studio 和 IntelliJ IDEA CE 中找到任何支持最基本的 JavaScript 的插件。

Does anyone have either a working JavaScript plugin for Android Studio (no fancy stuff. only basic code completion needed) or another possibility to add suport for using JavaScript libraries for code completion?

有没有人有一个适用于 Android Studio 的 JavaScript 插件(没有花哨的东西。只需要基本的代码完成)或另一种可能性来添加使用 JavaScript 库进行代码完成的支持?

EDIT:

编辑:

The existent answer to the question linked in the comments does not solve my problem as I found this on IntelliJ's help page for FileWatchers:

评论中链接的问题的现有答案并不能解决我的问题,因为我在 IntelliJ 的 FileWatchers 帮助页面上找到了这个:

JavaScript files generated by File Watchers are excluded from code completion and refactoring.

文件观察器生成的 JavaScript 文件被排除在代码完成和重构之外。

As JavaScript code completion is crucial to my plugin, I'm still searching for a solution. An additional problem is, that I have to find a way to "export" my changes (hopefully in form of a plug-in) so others can import and use it.

由于 JavaScript 代码完成对我的插件至关重要,我仍在寻找解决方案。另一个问题是,我必须找到一种方法来“导出”我的更改(希望以插件的形式),以便其他人可以导入和使用它。

Any ideas on that?

对此有何想法?

回答by aga

I'm afraid there is (currently) no way you can get JavaScript support in Android Studio. I didn't find any community JavaScript plugins which could be used in the Intellij Idea CE (and, therefore, Android Studio). The only option you have is multi-IDE setup; use WebStorm for JavaScript and Android Studio for Android.

恐怕(目前)您无法在 Android Studio 中获得 JavaScript 支持。我没有找到任何可以在 Intellij Idea CE(以及 Android Studio)中使用的社区 JavaScript 插件。您唯一的选择是多 IDE 设置;使用 WebStorm for JavaScript 和 Android Studio for Android。

回答by Marka A

Peter Schmalfeldt has created a repo to address this here:

Peter Schmalfeldt 创建了一个 repo 来解决这个问题:

https://github.com/manifestinteractive/android-studio-filetypes

https://github.com/manifestinteractive/android-studio-filetypes

Just follow the repo instruction which I quote here:

只需按照我在此处引用的 repo 说明进行操作:

From Android Studio Menu, go to File -> Import Settings... Locate the settings.jar file from this repository From "Select Components to Import" make sure you have "File types" checked, then press OK

从 Android Studio 菜单,转到文件 -> 导入设置...从该存储库中找到 settings.jar 文件从“选择要导入的组件”确保选中“文件类型”,然后按 OK

回答by Marka A

1. just copy all the plugins and configurations from IntelliJ IDEA (the free community version) folder by folder and paste it into the Android-Studio ones, not overriding existing ones, worked for me + some useful stuff like PHP debugging, this is now my goto editor (..wellllll... Notepad++... wellllll... Notepad2 then Nodepad++)

2. Open the A.S..S, Choose Invalidate Cache And Restartfrom the Filemenu.
3. Done.
4. ?
5. Profit.

1. 只需从 IntelliJ IDEA(免费社区版)文件夹中复制所有插件和配置,然后将其粘贴到 Android-Studio 中,而不是覆盖现有的,对我有用 + 一些有用的东西,例如 PHP 调试,这是现在我的转到编辑器(..wellllll... Notepad++... wellllll... Notepad2 然后 Nodepad++)

2. 打开AS ..SInvalidate Cache And RestartFile菜单中选择。
3. 完成。
4. ?
5. 利润。