File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
import * as vscode from "vscode" ;
2
2
import { AtelierAPI } from "../api" ;
3
+ import { outputChannel } from "../utils" ;
3
4
4
5
export class XmlContentProvider implements vscode . TextDocumentContentProvider {
5
6
private _api : AtelierAPI ;
@@ -10,12 +11,23 @@ export class XmlContentProvider implements vscode.TextDocumentContentProvider {
10
11
}
11
12
12
13
public provideTextDocumentContent ( uri : vscode . Uri , token : vscode . CancellationToken ) : vscode . ProviderResult < string > {
13
- // uri.query.
14
14
return vscode . workspace
15
15
. openTextDocument ( vscode . Uri . file ( uri . fragment ) )
16
16
. then ( ( document ) => document . getText ( ) )
17
- . then ( ( text ) => this . _api . cvtXmlUdl ( text ) )
18
- . then ( ( data ) => data . result . content [ 0 ] . content . join ( "\n" ) ) ;
17
+ . then ( ( text ) => {
18
+ return this . _api
19
+ . cvtXmlUdl ( text )
20
+ . then ( ( data ) => data . result . content [ 0 ] . content . join ( "\n" ) )
21
+ . catch ( ( error ) => {
22
+ let message = `Failed to convert XML of '${ uri . path . slice ( 1 ) } ' to UDL.` ;
23
+ if ( error . errorText && error . errorText !== "" ) {
24
+ outputChannel . appendLine ( "\n" + error . errorText ) ;
25
+ outputChannel . show ( true ) ;
26
+ message += " Check 'ObjectScript' Output channel for details." ;
27
+ }
28
+ vscode . window . showErrorMessage ( message , "Dismiss" ) ;
29
+ } ) ;
30
+ } ) ;
19
31
}
20
32
21
33
public get onDidChange ( ) : vscode . Event < vscode . Uri > {
You can’t perform that action at this time.
0 commit comments