2016-08-25 1 views
0

私はxtextプロジェクトを作成しました。 Formatクラスはありませんが、Ctrl + Fを押すとデフォルトの書式設定が生成されます。XTextでの書式化を防ぐ方法

どのようにフォーマットを防止できますか?私はフォーマッタクラスをオーバーライドする必要があることをお勧めしますが、どのようにしてこのクラスを生成できますか?あるいは、プロジェクトの設定でデフォルトの書式設定ができないようにすることはできますか?

よろしく、 ウラジミール

答えて

0

あなたはどちらかだけでクラス

class MyDslRuntimeModule extends AbstractMyDslRuntimeModule { 

    def Class<? extends IFormatter2> bindIFormatter2() { 
     Formatter2NullImpl 
    } 

    def void configureFormatterPreferences(Binder binder) { 
     binder.bind(IPreferenceValuesProvider).annotatedWith(FormatterPreferences).to(FormatterPreferenceValuesProvider); 
    } 

} 

class Formatter2NullImpl implements IFormatter2 { 

    override format(FormatterRequest request) { 
     return #[] 
    } 

} 

@FinalFieldsConstructor 
class MyDslUiModule extends AbstractMyDslUiModule { 

    override Class<? extends IContentFormatterFactory> bindIContentFormatterFactory() { 
     return org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory; 
    } 
} 

"を作成する" またはそう

language = StandardLanguage { 
    ... 
    formatter = { 
     generateStub = true 
    } 
    ... 
} 

を行うためのワークフローを設定し、生成されたクラスを編集することができます

関連する問題