elm-language-server icon indicating copy to clipboard operation
elm-language-server copied to clipboard

Standalone compiler API

Open jmbockhorst opened this issue 3 years ago • 0 comments

Refactor the compiler api so that it can be used as a standalone application by other projects.

Usage would look like

import { createProgram } from '@elm-tooling/elm-language-server';

const program = await createProgram(URI.parse('path-root-root-uri'));

const checker = program.getTypeChecker();
const sourceFile = program.getSourceFile('some-file-uri');

sourceFile.tree.rootNode.children.forEach((node) => {
	if (node.type === 'value_declaration') {
		const type = checker.findType(node);
	}
});

jmbockhorst avatar Mar 31 '21 00:03 jmbockhorst