@@ -53,11 +53,6 @@ export function activate(context: ExtensionContext) {
5353 const extensionPath : string = context . extensionPath ;
5454 logger . debug ( 'activate(): activating from extPath:' , context . extensionPath ) ;
5555
56- // register binary data content providers for viewing those files as json
57- const avroDataProvider : AvroContentProvider = new AvroContentProvider ( ) ;
58- addDataProvider ( context , avroDataProvider , 'avro' , 'json' ) ;
59- // TODO: add Arrow & binary Excel data files content providers + Excel html/xml to json :)
60-
6156 // initialize data preview webview panel html template
6257 const templateManager : ITemplateManager = new TemplateManager ( context . asAbsolutePath ( 'templates' ) ) ;
6358 const dataViewTemplate : Template = templateManager . getTemplate ( 'data.view.html' ) ;
@@ -139,70 +134,6 @@ function createDataPreviewCommand(
139134 return dataWebview ;
140135}
141136
142- /**
143- * Adds custom text document data provider commands
144- * for Avro, Arrow & Excel binary & html/xml data formats.
145- * @param context Extension context.
146- * @param dataProvider Data provider instance.
147- * @param fileType Data file type: avro, arrow, excel, etc.
148- * @param viewType Data provider output file type: only json for now :)
149- */
150- function addDataProvider (
151- context : ExtensionContext ,
152- dataProvider : TextDocumentContentProvider ,
153- fileType : string ,
154- viewType : string ) :void {
155-
156- let commandName : string = `${ fileType } .data.${ viewType } ` ;
157- // add text document content provider
158- context . subscriptions . push (
159- workspace . registerTextDocumentContentProvider ( commandName , dataProvider ) ) ;
160-
161- // add text editor command
162- /*
163- context.subscriptions.push(
164- commands.registerTextEditorCommand(commandName,
165- textEditor => showTextDocument(textEditor.document.uri, fileType, viewType)));
166- */
167-
168- // add regular json data view command
169- commands . registerCommand ( commandName , ( uri ) => {
170- showTextDocument ( uri , fileType , viewType ) ;
171- } ) ;
172-
173- // add data schema json view command
174- commandName = `${ fileType } .data.schema.${ viewType } ` ;
175- commands . registerCommand ( commandName , ( uri ) => {
176- showTextDocument ( uri , fileType , 'schema.json' ) ;
177- } ) ;
178- } // end of addDataProvider()
179-
180- /**
181- * Opens Text document.
182- * @param dataUri Data file uri.
183- * @param fileType Data file type: avro, arrow, excel, etc.
184- * @param viewType Text view type: json || schema.json.
185- */
186- function showTextDocument ( dataUri : Uri , fileType : string , viewType : string = 'json' ) {
187- if ( ! dataUri && window . activeTextEditor ) { // use open text editor uri
188- dataUri = window . activeTextEditor . document . uri ;
189- }
190- if ( ! dataUri ) {
191- // show no valid data Uri error message ???
192- return ;
193- }
194- logger . debug ( 'showTextDocument(): dataUri:' , dataUri ) ;
195-
196- if ( ! dataUri . fsPath . endsWith ( fileType ) ) {
197- window . showErrorMessage ( `Open .${ fileType } data file to Preview.` ) ;
198- return ; // no editor
199- } else if ( ! dataUri . scheme . startsWith ( fileType ) ) {
200- const textUri : Uri = Uri . parse ( //`${fileType}.data.${viewType}:
201- `file://${ dataUri . fsPath } .${ viewType } ` ) ;
202- window . showTextDocument ( textUri ) ;
203- }
204- }
205-
206137/**
207138 * Checks if the vscode text document is a data file.
208139 * @param document The vscode text document to check.
0 commit comments