@@ -5,7 +5,13 @@ import { Directory } from "./Directory";
55import { File } from "./File" ;
66import { fireOtherStudioAction , OtherStudioAction } from "../../commands/studio" ;
77import { projectContentsFromUri , studioOpenDialogFromURI } from "../../utils/FileProviderUtil" ;
8- import { notNull , outputChannel , redirectDotvscodeRoot , workspaceFolderOfUri } from "../../utils/index" ;
8+ import {
9+ isClassDeployed ,
10+ notNull ,
11+ outputChannel ,
12+ redirectDotvscodeRoot ,
13+ workspaceFolderOfUri ,
14+ } from "../../utils/index" ;
915import { config , workspaceState } from "../../extension" ;
1016import { addIsfsFileToProject , modifyProject } from "../../commands/project" ;
1117import { DocumentContentProvider } from "../DocumentContentProvider" ;
@@ -306,18 +312,16 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
306312 // Use _lookup() instead of _lookupAsFile() so we send
307313 // our cached mtime with the GET /doc request if we have it
308314 return this . _lookup ( uri ) . then (
309- ( ) => {
315+ async ( ) => {
310316 // Weirdly, if the file exists on the server we don't actually write its content here.
311317 // Instead we simply return as though we wrote it successfully.
312318 // The actual writing is done by our workspace.onDidSaveTextDocument handler.
313319 // But first check cases for which we should fail the write and leave the document dirty if changed.
314320 if ( ! csp && fileName . split ( "." ) . pop ( ) . toLowerCase ( ) === "cls" ) {
315321 // Check if the class is deployed
316- api . actionIndex ( [ fileName ] ) . then ( ( result ) => {
317- if ( result . result . content [ 0 ] . content . depl ) {
318- throw new Error ( "Cannot overwrite a deployed class" ) ;
319- }
320- } ) ;
322+ if ( await isClassDeployed ( fileName , api ) ) {
323+ throw new Error ( "Cannot overwrite a deployed class" ) ;
324+ }
321325 // Check if the class name and file name match
322326 let clsname = "" ;
323327 const match = content . toString ( ) . match ( / ^ [ \t ] * C l a s s [ \t ] + ( % ? [ \p{ L} \d ] + (?: \. [ \p{ L} \d ] + ) + ) / imu) ;
0 commit comments