2 * Copyright 2000-2015 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.json;/*
17 * Copyright 2000-2015 JetBrains s.r.o.
19 * Licensed under the Apache License, Version 2.0 (the "License");
20 * you may not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
23 * http://www.apache.org/licenses/LICENSE-2.0
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS,
27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
32 import com.intellij.embedding.EmbeddingElementType;
33 import com.intellij.javascript.JSScriptContentProvider;
34 import com.intellij.lang.HtmlScriptContentProvider;
35 import com.intellij.lexer.Lexer;
36 import com.intellij.psi.tree.IElementType;
37 import org.jetbrains.annotations.Nullable;
40 * Json as embedded script
42 * @author Ilya.Kazakevich
44 public final class JsonScriptContentProvider implements HtmlScriptContentProvider {
46 private static final JsonEmbedded JSON_EMBEDDED = new JsonEmbedded();
49 public IElementType getScriptElementType() {
55 public Lexer getHighlightingLexer() {
56 // TODO: temporary solution:
58 * We do not have highlighting JSON lexer for embedded environment for now, so we reuse JScript
60 return new JSScriptContentProvider().getHighlightingLexer();
63 private static final class JsonEmbedded extends IElementType implements EmbeddingElementType {
64 private JsonEmbedded() {
65 super("JSON_EMBEDDED", JsonLanguage.INSTANCE);