Skip to content

Commit

Permalink
We don't need to store the project in STGroupHighlightingPassFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
bjansen committed Jun 6, 2020
1 parent d606042 commit f054655
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ language: java
jdk:
- openjdk8
env:
- IDEA_VERSION=IC-2016.3.8
- IDEA_VERSION=IC-2017.3.6
- IDEA_VERSION=IC-2018.2.7
- IDEA_VERSION=IC-2018.3.3
- IDEA_VERSION=IC-2019.3
- IDEA_VERSION=IC-2020.1

script:
- ./gradlew build -PideaVersion=$IDEA_VERSION
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IntelliJ Plugin for StringTemplate v4 [![Build Status](https://travis-ci.org/antlr/jetbrains-plugin-st4.svg?branch=master)](https://travis-ci.org/antlr/jetbrains-plugin-st4) [![Latest version](https://img.shields.io/jetbrains/plugin/v/8041.svg?label=latest%20version)](https://plugins.jetbrains.com/plugin/8041-stringtemplate-v4-plugin) ![Downloads](https://img.shields.io/jetbrains/plugin/d/8041.svg)

A plugin that adds support for StringTemplate v4 to [IntelliJ](https://www.jetbrains.com/idea/)-based IDEs (version 13.x and later).
A plugin that adds support for StringTemplate v4 to [IntelliJ](https://www.jetbrains.com/idea/)-based IDEs (version 15.x and later).

It understands `.stg` files (not .st files yet). For example,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
public class STGroupHighlightingPassFactory
implements TextEditorHighlightingPassFactory, TextEditorHighlightingPassFactoryRegistrar
{
private Project project;

@Nullable
@Override
public TextEditorHighlightingPass createHighlightingPass(PsiFile file, Editor editor) {
public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) {
if ( editor==null ) return null;
Document doc = editor.getDocument();
Project project = editor.getProject();
VirtualFile vfile = FileDocumentManager.getInstance().getFile(doc);
if ( vfile==null || !vfile.getName().endsWith(".stg") ) return null;
if ( project == null || vfile==null || !vfile.getName().endsWith(".stg") ) return null;
return new STGroupHighlightingPass(project, editor);
}

@Override
public void registerHighlightingPassFactory(@NotNull TextEditorHighlightingPassRegistrar registrar, @NotNull Project project) {
this.project = project;
public void registerHighlightingPassFactory(@NotNull TextEditorHighlightingPassRegistrar registrar,
@NotNull Project project) {
registrar.registerTextEditorHighlightingPass(this, null, null, true, -1);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</change-notes>

<!-- please see http://confluence.jetbrains.net/display/IDEADEV/Build+Number+Ranges for description -->
<idea-version since-build="143.0"/> <!-- requires 15.x due to Java 7 requirements of ANTLR 4.7 -->
<idea-version since-build="192.5729"/> <!-- requires 15.x due to Java 7 requirements of ANTLR 4.7 -->

<!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
on how to target different products -->
Expand Down

0 comments on commit f054655

Please sign in to comment.