mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Adopt monaco-editor-core that doesn't register html
This commit is contained in:
parent
e1a09ac16d
commit
83bf09fbef
4 changed files with 15 additions and 3 deletions
|
|
@ -26,7 +26,7 @@
|
|||
"jsdom-no-contextify": "^3.1.0",
|
||||
"merge-stream": "^1.0.0",
|
||||
"mocha": "^2.5.3",
|
||||
"monaco-editor-core": "0.7.0",
|
||||
"monaco-editor-core": "0.7.0-next.2",
|
||||
"object-assign": "^4.1.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"typescript": "^1.8.10",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ interface ILangImpl {
|
|||
|
||||
let languageDefinitions:{[languageId:string]:ILang} = {};
|
||||
|
||||
export function loadLanguage(languageId:string): monaco.Promise<void> {
|
||||
function _loadLanguage(languageId:string): monaco.Promise<void> {
|
||||
let module = languageDefinitions[languageId].module;
|
||||
return new _monaco.Promise<void>((c, e, p) => {
|
||||
require<ILangImpl>([module], (mod) => {
|
||||
|
|
@ -31,6 +31,15 @@ export function loadLanguage(languageId:string): monaco.Promise<void> {
|
|||
});
|
||||
}
|
||||
|
||||
let languagePromises:{[languageId:string]: monaco.Promise<void>} = {};
|
||||
|
||||
export function loadLanguage(languageId:string): monaco.Promise<void> {
|
||||
if (!languagePromises[languageId]) {
|
||||
languagePromises[languageId] = _loadLanguage(languageId);
|
||||
}
|
||||
return languagePromises[languageId];
|
||||
}
|
||||
|
||||
function registerLanguage(def:ILang): void {
|
||||
let languageId = def.id;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export const htmlTokenTypes = {
|
|||
DELIM_START: 'start.delimiter.tag.html',
|
||||
DELIM_END: 'end.delimiter.tag.html',
|
||||
DELIM_COMMENT: 'comment.html',
|
||||
COMMENT: 'comment.content.html',
|
||||
getTag: (name: string) => {
|
||||
return 'tag.html';
|
||||
}
|
||||
|
|
@ -43,7 +44,7 @@ export const htmlTokenTypes = {
|
|||
export var language = <ILanguage> {
|
||||
defaultToken: '',
|
||||
tokenPostfix: '',
|
||||
ignoreCase: true,
|
||||
// ignoreCase: true,
|
||||
|
||||
// The main tokenizer for our languages
|
||||
tokenizer: {
|
||||
|
|
|
|||
|
|
@ -1840,6 +1840,8 @@ testTokenization(['php', 'css'], [
|
|||
line: '<!--c--><?',
|
||||
tokens: [
|
||||
{ startIndex:0, type: htmlTokenTypes.DELIM_COMMENT },
|
||||
{ startIndex:4, type: htmlTokenTypes.COMMENT },
|
||||
{ startIndex:5, type: htmlTokenTypes.DELIM_COMMENT },
|
||||
{ startIndex:8, type: 'metatag.php' }
|
||||
]}],
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue