2016-08-25 6 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 
    } 
    ... 
} 

을 수행 할 워크 플로우를 구성하고 생성 된 클래스를 편집 할 수 있습니다

관련 문제