Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added parser & code folding.

  • Loading branch information...
commit 8de7b3de45395222ac0f7b15c41daf3747a011c4 1 parent d9bb5be
Sebastian Hörl authored
View
2  manifest.mf
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.php.twig/2
-OpenIDE-Module-Implementation-Version: 2
+OpenIDE-Module-Implementation-Version: 3
OpenIDE-Module-Layer: org/netbeans/modules/php/twig/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/twig/Bundle.properties
View
4 nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=864f18ba
+build.xml.data.CRC32=2a2fd444
build.xml.script.CRC32=12d8ce43
build.xml.stylesheet.CRC32=a56c6a5b@1.45.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=864f18ba
+nbproject/build-impl.xml.data.CRC32=2a2fd444
nbproject/build-impl.xml.script.CRC32=0502fb72
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
View
10 nbproject/project.xml
@@ -115,6 +115,15 @@
</run-dependency>
</dependency>
<dependency>
+ <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.17.1.7.9</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<build-prerequisite/>
<compile-dependency/>
@@ -176,6 +185,7 @@
<package>org.netbeans.modules.php.twig.editor.embedding</package>
<package>org.netbeans.modules.php.twig.editor.gsf</package>
<package>org.netbeans.modules.php.twig.editor.lexer</package>
+ <package>org.netbeans.modules.php.twig.editor.parsing</package>
</public-packages>
</data>
</configuration>
View
17 src/org/netbeans/modules/php/twig/editor/TwigEditorKit.java
@@ -1,10 +1,27 @@
package org.netbeans.modules.php.twig.editor;
+import java.io.IOException;
+import javax.swing.text.Document;
+import org.netbeans.api.editor.mimelookup.MimeLookup;
+import org.netbeans.api.lexer.Language;
import org.netbeans.modules.editor.NbEditorKit;
+import org.netbeans.spi.editor.fold.FoldManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.Repository;
+import org.openide.util.Exceptions;
public class TwigEditorKit extends NbEditorKit {
@Override
+ public Document createDefaultDocument() {
+
+ return super.createDefaultDocument();
+
+ }
+
+ @Override
public String getContentType() {
return "text/twig";
}
View
6 src/org/netbeans/modules/php/twig/editor/embedding/TwigEmbeddingProvider.java
@@ -45,18 +45,18 @@
if ( offset < 0 ) offset = sequence.offset();
length += t.length();
} else if ( offset >= 0 ) {
- embeddings.add( snapshot.create( offset, length, "text/xhtml" ) );
+ embeddings.add( snapshot.create( offset, length, "text/html" ) );
offset = -1;
length = 0;
}
}
if ( offset >= 0 ) {
- embeddings.add( snapshot.create( offset, length, "text/xhtml" ) );
+ embeddings.add( snapshot.create( offset, length, "text/html" ) );
}
if (embeddings.isEmpty()) {
- return Collections.emptyList();
+ return Collections.singletonList( snapshot.create( "", "text/html" ) );
} else {
return Collections.singletonList( Embedding.create(embeddings) );
}
View
71 src/org/netbeans/modules/php/twig/editor/fold/TwigFoldManager.java
@@ -1,71 +0,0 @@
-package org.netbeans.modules.php.twig.editor.fold;
-
-import javax.swing.event.DocumentEvent;
-import javax.swing.text.BadLocationException;
-import org.netbeans.api.editor.fold.Fold;
-import org.netbeans.api.editor.fold.FoldType;
-import org.netbeans.spi.editor.fold.FoldHierarchyTransaction;
-import org.netbeans.spi.editor.fold.FoldManager;
-import org.netbeans.spi.editor.fold.FoldManagerFactory;
-import org.netbeans.spi.editor.fold.FoldOperation;
-import org.openide.util.Exceptions;
-
-public class TwigFoldManager implements FoldManager {
-
- protected FoldOperation operation;
-
- @Override
- public void init(FoldOperation fo) {
- operation = fo;
- System.out.println( "TwigFoldManager::init" );
- System.out.flush();
- }
-
- @Override
- public void initFolds(FoldHierarchyTransaction fht) {
- System.out.println( "TwigFoldManager::initFolds" );
- System.out.flush();
- try {
- try {
- operation.addToHierarchy( new FoldType("moin") , "test", true, 1, 50, 2, 2, null, fht );
- } catch (BadLocationException ex) {
- Exceptions.printStackTrace(ex);
- }
- } finally {
- fht.commit();
- }
- }
-
- @Override
- public void insertUpdate(DocumentEvent de, FoldHierarchyTransaction fht) {}
-
- @Override
- public void removeUpdate(DocumentEvent de, FoldHierarchyTransaction fht) {}
-
- @Override
- public void changedUpdate(DocumentEvent de, FoldHierarchyTransaction fht) {}
-
- @Override
- public void removeEmptyNotify(Fold fold) {}
-
- @Override
- public void removeDamagedNotify(Fold fold) {}
-
- @Override
- public void expandNotify(Fold fold) {}
-
- @Override
- public void release() {}
-
- public static final class Factory implements FoldManagerFactory {
-
- @Override
- public FoldManager createFoldManager() {
- System.out.println( "TwigFoldManager$Factory::createFoldManager" );
- System.out.flush();
- return new TwigFoldManager();
- }
-
- }
-
-}
View
9 src/org/netbeans/modules/php/twig/editor/gsf/TwigLanguage.java
@@ -1,7 +1,7 @@
/**
* Twig for Netbeans
*
- * Copyright (c) 2011 Sebastian Hörl
+ * Copyright (c) 2011 Sebastian Hörl
*
* For warranty and licesning information, view the LICENSE file.
*/
@@ -15,8 +15,9 @@
import org.netbeans.modules.csl.spi.LanguageRegistration;
import org.netbeans.modules.parsing.spi.Parser;
import org.netbeans.modules.php.twig.editor.lexer.TwigTopTokenId;
+import org.netbeans.modules.php.twig.editor.parsing.TwigParser;
-@LanguageRegistration(mimeType="text/twig", useCustomEditorKit=false) //NOI18N
+@LanguageRegistration(mimeType="text/twig", useCustomEditorKit=true) //NOI18N
public class TwigLanguage extends DefaultLanguageConfig {
public TwigLanguage() {}
@@ -38,13 +39,13 @@ public TwigLanguage() {}
// Service registrations
@Override
- public boolean isUsingCustomEditorKit() { return false; }
+ public boolean isUsingCustomEditorKit() { return true; }
@Override
public Parser getParser() { return new TwigParser(); }
@Override
- public boolean hasStructureScanner() { return true; }
+ public boolean hasStructureScanner() { return false; }
@Override
public StructureScanner getStructureScanner() { return new TwigStructureScanner(); }
View
55 src/org/netbeans/modules/php/twig/editor/gsf/TwigParser.java
@@ -1,55 +0,0 @@
-/**
- * Twig for Netbeans
- *
- * Copyright (c) 2011 Sebastian Hörl
- *
- * For warranty and licesning information, view the LICENSE file.
- */
-
-package org.netbeans.modules.php.twig.editor.gsf;
-
-import java.util.Collections;
-import java.util.List;
-import javax.swing.event.ChangeListener;
-import org.netbeans.modules.csl.api.Error;
-import org.netbeans.modules.csl.spi.ParserResult;
-import org.netbeans.modules.parsing.api.Snapshot;
-import org.netbeans.modules.parsing.api.Task;
-import org.netbeans.modules.parsing.spi.ParseException;
-import org.netbeans.modules.parsing.spi.Parser;
-import org.netbeans.modules.parsing.spi.SourceModificationEvent;
-
-public class TwigParser extends Parser {
-
- private Result fakeResult;
-
- @Override
- public void parse(Snapshot snapshot, Task task, SourceModificationEvent event) throws ParseException {
- fakeResult = new TwigFakeParserResult( snapshot );
- }
-
- @Override
- public Result getResult(Task task) throws ParseException { return fakeResult; }
-
- @Override
- public void cancel() {}
-
- @Override
- public void addChangeListener(ChangeListener changeListener) {}
-
- @Override
- public void removeChangeListener(ChangeListener changeListener) {}
-
- private static class TwigFakeParserResult extends ParserResult {
-
- public TwigFakeParserResult( Snapshot s ) { super(s); }
-
- @Override
- public List<? extends Error> getDiagnostics() { return Collections.emptyList(); }
-
- @Override
- protected void invalidate() { }
-
- }
-
-}
View
33 src/org/netbeans/modules/php/twig/editor/gsf/TwigStructureScanner.java
@@ -1,28 +1,55 @@
/**
* Twig for Netbeans
*
- * Copyright (c) 2011 Sebastian Hörl
+ * Copyright (c) 2011 Sebastian Hörl
*
* For warranty and licesning information, view the LICENSE file.
*/
package org.netbeans.modules.php.twig.editor.gsf;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import javax.swing.ImageIcon;
+import org.netbeans.modules.csl.api.ElementHandle;
+import org.netbeans.modules.csl.api.ElementKind;
+import org.netbeans.modules.csl.api.HtmlFormatter;
+import org.netbeans.modules.csl.api.Modifier;
import org.netbeans.modules.csl.api.OffsetRange;
import org.netbeans.modules.csl.api.StructureItem;
import org.netbeans.modules.csl.api.StructureScanner;
import org.netbeans.modules.csl.spi.ParserResult;
+import org.netbeans.modules.php.twig.editor.parsing.TwigParserResult;
+import org.openide.filesystems.FileObject;
public class TwigStructureScanner implements StructureScanner {
@Override
- public List<? extends StructureItem> scan(ParserResult info) { return Collections.emptyList(); }
+ public List<? extends StructureItem> scan( ParserResult info ) {
+ return Collections.emptyList();
+ }
@Override
- public Map<String, List<OffsetRange>> folds(ParserResult info) { return Collections.emptyMap(); }
+ public Map<String, List<OffsetRange>> folds( ParserResult info ) {
+
+ TwigParserResult result = (TwigParserResult)info;
+ Map<String, List<OffsetRange>> folds = new HashMap<String, List<OffsetRange>>();
+
+ for ( TwigParserResult.Block block : result.getBlocks() ) {
+
+ folds.put( "codeblocks", Collections.singletonList( new OffsetRange(
+ block.getOffset(), block.getOffset() + block.getLength()
+ ) ) );
+
+ }
+
+ return folds;
+
+ }
@Override
public Configuration getConfiguration() { return null; }
View
278 src/org/netbeans/modules/php/twig/editor/parsing/TwigParser.java
@@ -0,0 +1,278 @@
+package org.netbeans.modules.php.twig.editor.parsing;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Stack;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.lexer.LanguagePath;
+import org.netbeans.api.lexer.Token;
+import org.netbeans.api.lexer.TokenHierarchy;
+import org.netbeans.api.lexer.TokenSequence;
+import org.netbeans.modules.parsing.api.Snapshot;
+import org.netbeans.modules.parsing.api.Task;
+import org.netbeans.modules.parsing.spi.ParseException;
+import org.netbeans.modules.parsing.spi.Parser;
+import org.netbeans.modules.parsing.spi.ParserFactory;
+import org.netbeans.modules.parsing.spi.SourceModificationEvent;
+import org.netbeans.modules.php.twig.editor.lexer.TwigTokenId;
+
+public class TwigParser extends Parser {
+
+ Snapshot snapshot;
+ TwigParserResult result;
+
+ final static List<String> parseElements = new ArrayList<String>();
+ static {
+ parseElements.add( "for" );
+ parseElements.add( "endfor" );
+
+ parseElements.add( "if" );
+ parseElements.add( "elseif" );
+ parseElements.add( "else" );
+ parseElements.add( "endif" );
+
+ parseElements.add( "block" );
+ parseElements.add( "endblock" );
+
+ parseElements.add( "set" );
+ parseElements.add( "endset" );
+
+ parseElements.add( "macro" );
+ parseElements.add( "endmacro" );
+
+ parseElements.add( "filter" );
+ parseElements.add( "endfilter" );
+
+ parseElements.add( "autoescape" );
+ parseElements.add( "endautoescape" );
+
+ parseElements.add( "spaceless" );
+ parseElements.add( "endspaceless" );
+
+ }
+
+ @Override
+ public void parse( Snapshot snapshot, Task task, SourceModificationEvent sme ) throws ParseException {
+ this.snapshot = snapshot;
+ result = new TwigParserResult( snapshot );
+
+ TokenHierarchy<?> tokenHierarchy = snapshot.getTokenHierarchy();
+
+ LanguagePath twigPath = null;
+
+ for ( LanguagePath path : tokenHierarchy.languagePaths() ) {
+
+ if ( path.mimePath().endsWith( "twig-markup" ) ) { twigPath = path; break; }
+
+ }
+
+ if ( twigPath != null ) {
+
+ List<TokenSequence<?>> tokenSequenceList = tokenHierarchy.tokenSequenceList( twigPath, 0, Integer.MAX_VALUE );
+ List<Instruction> instructionList = new ArrayList<Instruction>();
+
+ for ( TokenSequence<?> sequence : tokenSequenceList ) {
+
+ while ( sequence.moveNext() ) {
+
+ Token<TwigTokenId> token = (Token<TwigTokenId>) sequence.token();
+
+ /* Parse instruction */
+
+ if ( token.id() == TwigTokenId.T_TWIG_INSTRUCTION ) {
+
+ Instruction instruction = new Instruction();
+ instruction.startTokenIndex = sequence.index();
+ instruction.endTokenIndex = sequence.index();
+ instruction.from = token.offset(tokenHierarchy);
+
+ while ( sequence.moveNext() ) {
+
+ token = (Token<TwigTokenId>) sequence.token();
+ if ( token.id() == TwigTokenId.T_TWIG_INSTRUCTION ) {
+ instruction.endTokenIndex = sequence.index();
+ instruction.length = token.offset(tokenHierarchy) - instruction.from + token.length();
+ break;
+ }
+
+ }
+
+ if ( instruction.startTokenIndex != instruction.endTokenIndex ) { // Closed instruction found
+
+ sequence.moveIndex( instruction.startTokenIndex );
+
+ while ( sequence.moveNext() ) {
+
+ token = (Token<TwigTokenId>) sequence.token();
+ if ( token.id() == TwigTokenId.T_TWIG_FUNCTION ) {
+
+ instruction.function = token.text().toString();
+ instruction.functionTokenIndex = sequence.index();
+ instruction.functionFrom = token.offset(tokenHierarchy);
+ instruction.functionLength = token.length();
+ break;
+
+ }
+
+ }
+
+ /* Have we captured a standalone instruction? */
+
+ if ( parseElements.contains( instruction.function ) )
+ {
+
+ if ( "block".equals(instruction.function) ) {
+
+ boolean standalone = false;
+
+ do {
+
+ sequence.moveNext();
+ token = (Token<TwigTokenId>)sequence.token();
+
+ if ( token.id() == TwigTokenId.T_TWIG_NAME || token.id() == TwigTokenId.T_TWIG_STRING ) {
+ standalone = true;
+ break;
+ }
+
+ } while ( sequence.index() < instruction.endTokenIndex );
+
+ if ( !standalone ) instructionList.add( instruction );
+
+ } else if ( "set".equals(instruction.function) ) {
+
+ boolean standalone = false;
+
+ do {
+
+ sequence.moveNext();
+ token = (Token<TwigTokenId>)sequence.token();
+
+ if ( token.id() == TwigTokenId.T_TWIG_OPERATOR ) {
+ standalone = true;
+ break;
+ }
+
+ } while ( sequence.index() < instruction.endTokenIndex );
+
+ if ( !standalone ) instructionList.add( instruction );
+
+ } else {
+ instructionList.add( instruction );
+ }
+
+ }
+
+ sequence.moveIndex( instruction.endTokenIndex );
+
+ }
+
+ }
+
+ }
+
+ } // endfor: All instructions are now saved in instructionList
+
+ /* Analyse instruction structure */
+
+ Stack<Instruction> instructionStack = new Stack<Instruction>();
+
+ for ( Instruction instruction : instructionList ) {
+
+ if ( instruction.function.startsWith( "end" ) ) {
+
+ if ( instructionStack.empty() ) { // End tag, but no more tokens on stack!
+
+ result.addError(
+ "Unopened '" + instruction.function + "' block",
+ instruction.functionFrom,
+ instruction.functionLength
+ );
+
+ } else if ( instruction.function.endsWith( instructionStack.peek().function ) ) {
+ // end[sth] found a [sth] on the stack!
+
+ Instruction start = instructionStack.pop();
+ result.addBlock( instruction.function, start.from, instruction.from - start.from + instruction.length );
+
+ } else {
+ // something wrong lies on the stack!
+ // assume that current token is invalid and let it stay on the stack
+
+ result.addError(
+ "Unexpected '" + instruction.function + "', expected 'end" + instructionStack.peek().function + "'",
+ instruction.functionFrom,
+ instruction.functionLength
+ );
+
+ }
+
+ } else {
+ instructionStack.push( instruction );
+ }
+
+ }
+
+ // All instructions were parsed. Are there any left on the stack?
+ if ( !instructionStack.empty() ) {
+ // Yep, they were never closed!
+
+ while ( !instructionStack.empty() ) {
+
+ Instruction instruction = instructionStack.pop();
+
+ result.addError(
+ "Unclosed '" + instruction.function + "'",
+ instruction.functionFrom,
+ instruction.functionLength
+ );
+
+ }
+
+ }
+
+ // Parsing is done!
+
+
+
+ }
+
+ }
+
+ @Override
+ public Result getResult(Task task) throws ParseException {
+ return result;
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener cl) {}
+
+ @Override
+ public void removeChangeListener(ChangeListener cl) {}
+
+ static public class Factory extends ParserFactory {
+
+ @Override
+ public Parser createParser( Collection<Snapshot> clctn ) {
+ return new TwigParser();
+ }
+
+ }
+
+ class Instruction {
+
+ String function = "";
+ int startTokenIndex = 0;
+ int endTokenIndex = 0;
+ int functionTokenIndex = 0;
+
+ int from = 0;
+ int length = 0;
+
+ int functionFrom = 0;
+ int functionLength = 0;
+
+ }
+
+}
View
143 src/org/netbeans/modules/php/twig/editor/parsing/TwigParserResult.java
@@ -0,0 +1,143 @@
+package org.netbeans.modules.php.twig.editor.parsing;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.netbeans.modules.csl.api.Severity;
+import org.netbeans.modules.csl.spi.ParserResult;
+import org.netbeans.modules.parsing.api.Snapshot;
+import org.openide.filesystems.FileObject;
+
+public class TwigParserResult extends ParserResult {
+
+ boolean valid = true;
+
+ List<Error> errorList = new ArrayList<Error>();
+ List<Block> blockList = new ArrayList<Block>();
+
+ TwigParserResult( Snapshot snapshot ) {
+ super( snapshot );
+ }
+
+ public List<Error> getErrors() { return errorList; }
+
+ public void addError( String description, int offset, int length ) {
+ errorList.add( new Error( description, offset, length, getSnapshot() ) );
+ }
+
+ public List<Block> getBlocks() { return blockList; }
+
+ public void addBlock( String function, int offset, int length ) {
+ blockList.add( new Block( function, offset, length ) );
+ }
+
+ @Override
+ protected void invalidate() {
+ valid = false;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ @Override
+ public List<? extends org.netbeans.modules.csl.api.Error> getDiagnostics() {
+ return errorList;
+ }
+
+ public class Error implements org.netbeans.modules.csl.api.Error {
+
+ String description;
+ int offset;
+ int length;
+ Snapshot snapshot;
+
+ public Error( String description, int offset, int length, Snapshot snapshot ) {
+ this.description = description;
+ this.offset = offset;
+ this.length = length;
+ this.snapshot = snapshot;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return description;
+ }
+
+ @Override
+ public String getKey() {
+ return description;
+ }
+
+ @Override
+ public FileObject getFile() {
+ return snapshot.getSource().getFileObject();
+ }
+
+ @Override
+ public int getStartPosition() {
+ return offset;
+ }
+
+ @Override
+ public int getEndPosition() {
+ return offset + length;
+ }
+
+ @Override
+ public boolean isLineError() {
+ return false;
+ }
+
+ @Override
+ public Severity getSeverity() {
+ return Severity.ERROR;
+ }
+
+ @Override
+ public Object[] getParameters() {
+ return null;
+ }
+
+ }
+
+ public class Block {
+
+ String function;
+ int offset;
+ int length;
+
+ public Block( String function, int offset, int length ) {
+ this.function = function;
+ this.offset = offset;
+ this.length = length;
+ }
+
+ public String getDescription() {
+ return function;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ }
+
+}
View
79 src/org/netbeans/modules/php/twig/editor/parsing/TwigSyntaxValidationTask.java
@@ -0,0 +1,79 @@
+package org.netbeans.modules.php.twig.editor.parsing;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.netbeans.modules.parsing.api.Snapshot;
+import org.netbeans.modules.parsing.spi.Parser.Result;
+import org.netbeans.modules.parsing.spi.ParserResultTask;
+import org.netbeans.modules.parsing.spi.Scheduler;
+import org.netbeans.modules.parsing.spi.SchedulerEvent;
+import org.netbeans.modules.parsing.spi.SchedulerTask;
+import org.netbeans.modules.parsing.spi.TaskFactory;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.editor.hints.HintsController;
+import org.netbeans.spi.editor.hints.Severity;
+
+public class TwigSyntaxValidationTask extends ParserResultTask {
+
+ boolean cancelled = false;
+
+ @Override
+ public void run( Result r, SchedulerEvent se ) {
+
+ TwigParserResult result = (TwigParserResult)r;
+ Document document = result.getSnapshot().getSource().getDocument( false );
+
+ List<ErrorDescription> errors = new ArrayList<ErrorDescription> ();
+
+ for ( TwigParserResult.Error error : result.getErrors() ) {
+
+ try {
+
+ errors.add( ErrorDescriptionFactory.createErrorDescription(
+ Severity.ERROR,
+ error.getDescription(),
+ document,
+ document.createPosition( error.getOffset() ),
+ document.createPosition( error.getOffset() + error.getLength() )
+ ) );
+
+ } catch ( BadLocationException ex ) {}
+
+ }
+
+ HintsController.setErrors( document, "Twig", errors );
+
+
+ cancelled = false;
+ }
+
+ @Override
+ public int getPriority() {
+ return 100;
+ }
+
+ @Override
+ public Class<? extends Scheduler> getSchedulerClass() {
+ return Scheduler.EDITOR_SENSITIVE_TASK_SCHEDULER;
+ }
+
+ @Override
+ public void cancel() {
+ cancelled = true;
+ }
+
+ static public class Factory extends TaskFactory {
+
+ @Override
+ public Collection<? extends SchedulerTask> create(Snapshot snpsht) {
+ return Collections.singleton( new TwigSyntaxValidationTask() );
+ }
+
+ }
+
+}
View
10 src/org/netbeans/modules/php/twig/resources/layer.xml
@@ -15,6 +15,14 @@
<attr name="instanceCreate" methodvalue="org.netbeans.modules.php.twig.editor.lexer.TwigTopTokenId.language"/>
<attr name="instanceOf" stringvalue="org.netbeans.api.lexer.Language"/>
</file>
+
+ <!--<file name="org-netbeans-modules-php-twig-editor-parsing-TwigParser$Factory.instance">
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.parsing.spi.ParserFactory"/>
+ </file>-->
+
+ <!--<file name="org-netbeans-modules-php-twig-editor-parsing-TwigSyntaxValidationTask$Factory.instance">
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.parsing.spi.TaskFactory"/>
+ </file>-->
<file name="org-netbeans-modules-php-twig-editor-embedding-TwigEmbeddingProvider$Factory.instance">
<attr name="instanceOf" stringvalue="org.netbeans.modules.parsing.spi.TaskFactory" />
@@ -154,7 +162,7 @@
<folder name="CslPlugins">
<folder name="text">
<folder name="twig">
- <attr name="useCustomEditorKit" boolvalue="false"/>
+ <attr name="useCustomEditorKit" boolvalue="true"/>
<file name="language.instance">
<attr name="instanceClass" stringvalue="org.netbeans.modules.php.twig.editor.gsf.TwigLanguage"/>
</file>
Please sign in to comment.
Something went wrong with that request. Please try again.