diff --git a/src/editor/lsp/language.ts b/src/editor/lsp/language.ts index 6f1ff10e1..7291f1a7c 100644 --- a/src/editor/lsp/language.ts +++ b/src/editor/lsp/language.ts @@ -9,6 +9,7 @@ import { LanguageServerClient } from '.' import { kclPlugin } from './plugin' import type * as LSP from 'vscode-languageserver-protocol' import { parser as jsParser } from '@lezer/javascript' +import { EditorState } from '@uiw/react-codemirror' const data = defineLanguageFacet({}) @@ -22,7 +23,25 @@ export default function kclLanguage(options: LanguageOptions): LanguageSupport { // For now let's use the javascript parser. // It works really well and has good syntax highlighting. // We can use our lsp for the rest. - const lang = new Language(data, jsParser, [], 'kcl') + const lang = new Language( + data, + jsParser, + [ + EditorState.languageData.of(() => [ + { + // https://codemirror.net/docs/ref/#commands.CommentTokens + commentTokens: { + line: '//', + block: { + open: '/*', + close: '*/', + }, + }, + }, + ]), + ], + 'kcl' + ) // Create our supporting extension. const kclLsp = kclPlugin({