forked from TypeFox/monaco-languageclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
import { createMonacoEditor, createUrl, doInit, initWebSocketAndStartClient } from './client-commons.js'; | ||
import { LanguageClientRunConfig } from './model.js'; | ||
/** LSP client runner */ | ||
export const runLanguageClient = async (config : LanguageClientRunConfig) => { | ||
const languageId = config.registerConfig.id; | ||
await doInit(config.vscodeApiInit, config.registerConfig); | ||
const editorDom = document.getElementById(config.htmlElementId); | ||
if (editorDom) { | ||
await createMonacoEditor({ | ||
htmlElement: editorDom, | ||
content: config.defaultContent, | ||
languageId | ||
}); | ||
const url = createUrl(config.clientUrl, config.serverPort, config.serverPath); | ||
initWebSocketAndStartClient(url, languageId); | ||
} else { | ||
console.error(`no dom element for css id: ${config.htmlElementId}`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters