-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
10 changed files
with
120 additions
and
60 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
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,9 @@ | ||
import 'monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution'; | ||
import 'monaco-editor/esm/vs/editor/contrib/format/browser/formatActions'; | ||
import 'monaco-editor/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching'; | ||
import 'monaco-editor/esm/vs/editor/contrib/hover/browser/hover'; | ||
import 'monaco-editor/esm/vs/editor/browser/coreCommands'; | ||
import 'monaco-editor/esm/vs/editor/contrib/clipboard/browser/clipboard'; | ||
import 'monaco-editor/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo'; | ||
import 'monaco-editor/esm/vs/editor/contrib/contextmenu/browser/contextmenu'; | ||
import 'monaco-editor/esm/vs/editor/contrib/find/browser/findController'; |
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,40 @@ | ||
/** | ||
* Copyright (c) 2021 GraphQL Contributors. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import type * as GraphQLMode from './graphqlMode'; | ||
import { create as createMonacoGraphQLAPI, MonacoGraphQLAPI } from './api'; | ||
import type { MonacoGraphQLInitializeConfig } from './typings'; | ||
import { languages } from './monaco-editor'; | ||
|
||
export const LANGUAGE_ID = 'graphql'; | ||
|
||
let api: MonacoGraphQLAPI; | ||
|
||
/** | ||
* Initialize the mode & worker synchronously with provided configuration | ||
* | ||
* @param config | ||
* @returns {MonacoGraphQLAPI} | ||
*/ | ||
export function initializeMode( | ||
config?: MonacoGraphQLInitializeConfig, | ||
): MonacoGraphQLAPI { | ||
if (!api) { | ||
api = createMonacoGraphQLAPI(LANGUAGE_ID, config); | ||
(languages as any).graphql = { api }; | ||
// export to the global monaco API | ||
|
||
// eslint-disable-next-line promise/prefer-await-to-then -- ignore to leave initializeMode sync | ||
void getMode().then(mode => mode.setupMode(api)); | ||
} | ||
|
||
return api; | ||
} | ||
|
||
function getMode(): Promise<typeof GraphQLMode> { | ||
return import('./graphqlMode'); | ||
} |
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 |
---|---|---|
@@ -1,40 +1,3 @@ | ||
/** | ||
* Copyright (c) 2021 GraphQL Contributors. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import './full'; | ||
|
||
import type * as GraphQLMode from './graphqlMode'; | ||
import { create as createMonacoGraphQLAPI, MonacoGraphQLAPI } from './api'; | ||
import type { MonacoGraphQLInitializeConfig } from './typings'; | ||
import { languages } from './monaco-editor'; | ||
|
||
export const LANGUAGE_ID = 'graphql'; | ||
|
||
let api: MonacoGraphQLAPI; | ||
|
||
/** | ||
* Initialize the mode & worker synchronously with provided configuration | ||
* | ||
* @param config | ||
* @returns {MonacoGraphQLAPI} | ||
*/ | ||
export function initializeMode( | ||
config?: MonacoGraphQLInitializeConfig, | ||
): MonacoGraphQLAPI { | ||
if (!api) { | ||
api = createMonacoGraphQLAPI(LANGUAGE_ID, config); | ||
(languages as any).graphql = { api }; | ||
// export to the global monaco API | ||
|
||
// eslint-disable-next-line promise/prefer-await-to-then -- ignore to leave initializeMode sync | ||
void getMode().then(mode => mode.setupMode(api)); | ||
} | ||
|
||
return api; | ||
} | ||
|
||
function getMode(): Promise<typeof GraphQLMode> { | ||
return import('./graphqlMode'); | ||
} | ||
export { initializeMode, LANGUAGE_ID } from './initialize'; |
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,4 @@ | ||
/** | ||
* monaco-graphql/lite with no exports | ||
*/ | ||
export { initializeMode, LANGUAGE_ID } from './initialize'; |
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