File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,13 @@ const Editor: Component<Props> = (props) => {
2929
3030 if ( props . formatter ) {
3131 languages . registerDocumentFormattingEditProvider ( 'typescript' , {
32- provideDocumentFormattingEdits : async ( model ) => {
32+ async provideDocumentFormattingEdits ( model ) {
3333 props . formatter ! . postMessage ( {
3434 event : 'FORMAT' ,
3535 code : model . getValue ( ) ,
3636 pos : editor . getPosition ( ) ,
3737 } ) ;
38+
3839 return new Promise ( ( resolve , reject ) => {
3940 props . formatter ! . addEventListener (
4041 'message' ,
@@ -72,11 +73,14 @@ const Editor: Component<Props> = (props) => {
7273 enabled : props . withMinimap ,
7374 } ,
7475 } ) ;
76+
7577 editor . onDidChangeModelContent ( ( ) => {
7678 props . onDocChange ?.( editor . getValue ( ) ) ;
7779 } ) ;
80+
7881 props . ref ?.( editor ) ;
7982 } ;
83+
8084 // Initialize Monaco
8185 onMount ( ( ) => setupEditor ( ) ) ;
8286 onCleanup ( ( ) => editor ?. dispose ( ) ) ;
@@ -85,9 +89,11 @@ const Editor: Component<Props> = (props) => {
8589 editor . setModel ( model ( ) ) ;
8690 liftOff ( ) ;
8791 } ) ;
92+
8893 createEffect ( ( ) => {
8994 mEditor . setTheme ( props . isDark ? 'vs-dark-plus' : 'vs-light-plus' ) ;
9095 } ) ;
96+
9197 createEffect ( ( ) => {
9298 const fontSize = zoomState . fontSize ;
9399 editor . updateOptions ( { fontSize } ) ;
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ editor.defineTheme('vs-dark-plus', vsDark as editor.IStandaloneThemeData);
9595editor . defineTheme ( 'vs-light-plus' , vsLight as editor . IStandaloneThemeData ) ;
9696
9797const hookLanguages = languages . setLanguageConfiguration ;
98+
9899languages . setLanguageConfiguration = (
99100 languageId : string ,
100101 configuration : languages . LanguageConfiguration ,
@@ -105,8 +106,8 @@ languages.setLanguageConfiguration = (
105106
106107export async function liftOff ( ) : Promise < void > {
107108 await loadingWasm ;
109+
108110 // wireTmGrammars only cares about the language part, but asks for all of monaco
109111 // we fool it by just passing in an object with languages
110-
111112 await wireTmGrammars ( { languages } as any , registry , grammars ) ;
112113}
You can’t perform that action at this time.
0 commit comments