Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code] Enabgle go language of the monaco editor. #33476

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/plugins/code/public/monaco/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import lightTheme from '@elastic/eui/dist/eui_theme_light.json';
// import 'monaco-editor/esm/vs/basic-languages/css/css.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/go/go.contribution.js';
import 'monaco-editor/esm/vs/basic-languages/go/go.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/html/html.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/ini/ini.contribution.js';
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/code/public/monaco/monaco_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { editor } from 'monaco-editor';
import chrome from 'ui/chrome';
import { ResizeChecker } from 'ui/resize_checker';
import { EditorActions } from '../components/editor/editor';
import { provideDefinition } from './definition/definition_provider';
Expand Down Expand Up @@ -43,6 +44,9 @@ export class MonacoHelper {
this.monaco.languages.registerDefinitionProvider('java', definitionProvider);
this.monaco.languages.registerDefinitionProvider('typescript', definitionProvider);
this.monaco.languages.registerDefinitionProvider('javascript', definitionProvider);
if (chrome.getInjected('enableLangserversDeveloping', false) === true) {
this.monaco.languages.registerDefinitionProvider('go', definitionProvider);
}
const codeEditorService = new EditorService();
codeEditorService.setMonacoHelper(this);
this.editor = monaco.editor.create(
Expand Down
6 changes: 5 additions & 1 deletion x-pack/plugins/code/server/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,18 @@ async function initCodeNode(server: Server, serverOptions: ServerOptions, log: L
log.info('Initializing Code plugin as code-node.');
const queueIndex: string = server.config().get('xpack.code.queueIndex');
const queueTimeout: number = server.config().get('xpack.code.queueTimeout');
const devMode: boolean = server.config().get('env.dev');
const adminCluster = server.plugins.elasticsearch.getCluster('admin');

// @ts-ignore
const esClient: EsClient = adminCluster.clusterClient.client;
const repoConfigController = new RepositoryConfigController(esClient);

server.injectUiAppVars('code', () => ({
enableLangserversDeveloping: devMode,
}));
// Enable the developing language servers in development mode.
if (server.config().get('env.dev') === true) {
if (devMode === true) {
LanguageServers.push(...LanguageServersDeveloping);
}

Expand Down