Search in sources :

Example 1 with NullSourceDirectory

use of org.ballerinalang.langserver.workspace.repository.NullSourceDirectory in project ballerina by ballerina-lang.

the class CommonUtil method prepareTempCompilerContext.

/**
 * Prepare a new compiler context.
 * @return {@link CompilerContext} Prepared compiler context
 */
public static CompilerContext prepareTempCompilerContext() {
    CompilerContext context = new CompilerContext();
    CompilerOptions options = CompilerOptions.getInstance(context);
    options.put(PROJECT_DIR, "");
    options.put(COMPILER_PHASE, CompilerPhase.DESUGAR.toString());
    options.put(PRESERVE_WHITESPACE, "false");
    context.put(SourceDirectory.class, new NullSourceDirectory());
    return context;
}
Also used : CompilerContext(org.wso2.ballerinalang.compiler.util.CompilerContext) CompilerOptions(org.wso2.ballerinalang.compiler.util.CompilerOptions) NullSourceDirectory(org.ballerinalang.langserver.workspace.repository.NullSourceDirectory)

Aggregations

NullSourceDirectory (org.ballerinalang.langserver.workspace.repository.NullSourceDirectory)1 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)1 CompilerOptions (org.wso2.ballerinalang.compiler.util.CompilerOptions)1