Create custom javascript editor and add intellisense to it.

Hi,

I want to create custom Javascript editor and add javascript intellisense to it. Can anyone help me to add this functionality.

 

Thanks

 

0

Define "custom Javascript editor". What exactly do you want to achieve that is not available in IJ's bundled JS support?

0

Thanks for reply.

Actually I have a device which runs pre processed javascript. I have to create a custom editor which will contain preprocessed JS and html source code. So I have to provide JS intellisense in that editor.

IJ bundle provides intellisense in the editor with js extension while in my case the editor will have html extension and some additional methods and syntax different from normal javascript.

 

0

You can add com.intellij.psi.LanguageSubstitutor that will substitute html with whatever language you want.

For any syntax customisation you'll need to extend JavaScript language and tweak lexer/parser accordingly. You can see an example in AngularJS plugin sources

0

Thanks for reply.

I am working on intellij community edition. Can you give me example source for intellij community edition. The earlier example is of intellij ultimate edition.

 

 

0

Sorry, but JavaScript support is available only in ultimate edition. So there's no option to reuse existing JS support in community edition

0

Thanks for reply.

 

But I still can add custom JS support in community edition right? Or it is not possible?

0

Yes, you can. In this case you'll have to implement everything yourself: lexing, parsing, navigation, etc

 

0

Thanks for the reply.

 

I have a .flex file, which I have already used to create the lexer for javascript. I also have intellij javascript source code, Can you tell me how can I create parser for javascript. There is no tutorial available for that and I also don't have .bnf file to create the parser.

0

There's a tutorial on how to write parsers here http://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/implementing_parser_and_psi.html

"I also have intellij javascript source code" what do you mean exactly?

0

Thanks for reply

I have javascript editor source code developed by intellij. I have extracted it from an open source ide based on intellij. 

Can I use that parser in my custom editor?

 

0

If the license of that source allows it, of course.

0

if following is the licence statement in the source code:

/*
* Copyright 2000-2005 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
0

I'm not a lawyer :) but Apache License does allow it AFAIU

0

Ok anyway thanks for reply.

0

Hi,

I have integrated JavaScript parser code in my application, but whenever I run the build, the parse method of JavaScriptParser class is called recursively and then it exceeds the GC memory limit.

I want to know that whether it will be called recursively like this or am I doing something wrong.

 

0

Hi,

I am having a trouble in implementing the lexer parser. The official tutorial is also illustrated the concept of the parser, but doesn't tell how to code for creating the parser. Can anyone help me to resolve this issue or give me links of some source code for the intellij community version.

0

.

0

Hi, 

Can anyone tell me how to create language PsiImplUtil class?

Thanks

0

Hi,

Can someone provide me ".bnf" grammar file for javascript or ecmascript?

 

Thanks

 

0

请先登录再写评论。