-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #904 from BetterThanTomorrow/pez/prompt-tweaks
Load current repl window namespace
- Loading branch information
Showing
15 changed files
with
140 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,15 @@ | ||
import * as vscode from 'vscode'; | ||
import * as state from '../state'; | ||
import * as os from 'os'; | ||
import * as fs from 'fs'; | ||
import * as JSZip from 'jszip'; | ||
import * as util from '../utilities' | ||
|
||
export default class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { | ||
export default class JarContentProvider implements vscode.TextDocumentContentProvider { | ||
state: any; | ||
|
||
constructor() { | ||
this.state = state; | ||
} | ||
|
||
provideTextDocumentContent(uri, token) { | ||
let current = this.state.deref(); | ||
if (current.get('connected')) { | ||
return new Promise<string>((resolve, reject) => { | ||
let rawPath = uri.path, | ||
pathToFileInJar = rawPath.slice(rawPath.search('!/') + 2), | ||
pathToJar = rawPath.slice('file:'.length); | ||
|
||
pathToJar = pathToJar.slice(0, pathToJar.search('!')); | ||
if (os.platform() === 'win32') { | ||
pathToJar = pathToJar.replace(/\//g, '\\').slice(1); | ||
} | ||
|
||
fs.readFile(pathToJar, (err, data) => { | ||
let zip = new JSZip(); | ||
zip.loadAsync(data).then((new_zip) => { | ||
new_zip.file(pathToFileInJar).async("string").then((value) => { | ||
resolve(value); | ||
}) | ||
}) | ||
}); | ||
}); | ||
} else { | ||
console.warn("Unable to provide textdocumentcontent, not connected to nREPL"); | ||
} | ||
return util.getJarContents(uri); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.