@@ -78,60 +78,60 @@ class MonacoEditor extends React.PureComponent {
7878 }
7979 } )
8080
81- autorun ( ( ) => {
82- const languageClient = languageState . clients . get ( this . language )
83- if ( languageClient ) {
84- let path , content
85- if ( this . editor . file ) {
86- path = this . editor . file . path
87- content = this . editor . file . content
88- } else {
89- path = this . editor . uri
90- content = this . editor . content
91- }
92- /**
93- * client 状态
94- * enum ClientState {
95- * Initial, // 0
96- * Starting, // 1
97- * StartFailed, // 2
98- * Running, // 3
99- * Stopping, // 4
100- * Stopped, // 5
101- * }
102- */
103- const uri = path . startsWith ( 'jdt://' ) ? path : `file://${ languageClient . _ROOT_URI_ } ${ path } `
104- let model = monaco . editor . getModel ( uri )
105- if ( ! model ) {
106- model = monaco . editor . createModel (
107- content ,
108- lowerCase ( this . language ) ,
109- monaco . Uri . parse ( path . startsWith ( 'jdt://' ) ? path : `file://${ languageClient . _ROOT_URI_ } ${ path } ` )
110- )
111- this . uri = path . startsWith ( 'jdt://' ) ? path : `file://${ languageClient . _ROOT_URI_ } ${ path } `
112- const tmpModel = monaco . editor . getModel ( `inmemory://model/${ this . editor . id } ` )
113- if ( tmpModel ) {
114- tmpModel . dispose ( )
115- }
116- }
117- this . editor . model = model
118- monacoEditor . setModel ( model )
119- const { client, openeduri } = languageClient
120- if ( client && client . state === 3 && this . props . active && this . didmount ) {
121- if ( ! openeduri . get ( path ) ) {
122- languageClient . openTextDocument ( {
123- textDocument : {
124- uri : `file://${ languageClient . _ROOT_URI_ } ${ path } ` ,
125- languageId : lowerCase ( this . language ) ,
126- text : content ,
127- version : 1 ,
128- }
129- } )
130- openeduri . set ( path , content )
131- }
132- }
133- }
134- } )
81+ // autorun(() => {
82+ // const languageClient = languageState.clients.get(this.language)
83+ // if (languageClient) {
84+ // let path, content
85+ // if (this.editor.file) {
86+ // path = this.editor.file.path
87+ // content = this.editor.file.content
88+ // } else {
89+ // path = this.editor.uri
90+ // content = this.editor.content
91+ // }
92+ // /**
93+ // * client 状态
94+ // * enum ClientState {
95+ // * Initial, // 0
96+ // * Starting, // 1
97+ // * StartFailed, // 2
98+ // * Running, // 3
99+ // * Stopping, // 4
100+ // * Stopped, // 5
101+ // * }
102+ // */
103+ // const uri = path.startsWith('jdt://') || path.startsWith('omnisharp-metadata ') ? path : `file://${languageClient._ROOT_URI_}${path}`
104+ // let model = monaco.editor.getModel(uri)
105+ // if (!model) {
106+ // model = monaco.editor.createModel(
107+ // content,
108+ // this.language.toLowerCase( ),
109+ // monaco.Uri.parse(path.startsWith('jdt://') || path.startsWith('omnisharp-metadata ') ? path : `file://${languageClient._ROOT_URI_}${path}`)
110+ // )
111+ // this.uri = path.startsWith('jdt://') || path.startsWith('omnisharp-metadata ') ? path : `file://${languageClient._ROOT_URI_}${path}`
112+ // const tmpModel = monaco.editor.getModel(`inmemory://model/${this.editor.id}`)
113+ // if (tmpModel) {
114+ // tmpModel.dispose()
115+ // }
116+ // }
117+ // this.editor.model = model
118+ // monacoEditor.setModel(model)
119+ // const { client, openeduri } = languageClient
120+ // if (client && client.state === 3 && this.props.active && this.didmount) {
121+ // // if (!openeduri.get(path)) {
122+ // // languageClient.openTextDocument({
123+ // // textDocument: {
124+ // // uri: path.startsWith('jdt://') || path.startsWith('omnisharp-metadata') ? path : `file://${languageClient._ROOT_URI_}${path}`,
125+ // // languageId: this.language.toLowerCase( ),
126+ // // text: content,
127+ // // version: 1,
128+ // / / }
129+ // / / })
130+ // // openeduri.set(path, content)
131+ // / / }
132+ // }
133+ // }
134+ // })
135135 }
136136
137137 componentWillReceiveProps ( nextProps ) {
0 commit comments