Skip to content

Commit

Permalink
build: bumping avm-debugger dependency (#8)
Browse files Browse the repository at this point in the history
* fix: update to latest debugger
  • Loading branch information
aorumbayev authored Dec 15, 2023
1 parent dba1a1d commit 183a8a5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ jobs:
test:
strategy:
matrix:
# os: ['ubuntu-latest', 'windows-latest']
os: ['ubuntu-latest']
os: ['ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Before you can use the AVM Debugger extension, you need to ensure that you have

### Via VS Code Marketplace

1. Install the extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=algorandfoundation.algokit-avm-debugger). {TODO: TWEAK URL}
1. Install the extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=algorandfoundation.algokit-avm-vscode-debugger).
2. Follow the next steps in the [Usage](#usage) section.

### For Development
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"algosdk": "^2.7.0",
"avm-debug-adapter": "^0.1.1",
"avm-debug-adapter": "^0.1.2",
"lodash": "^4.17.21"
},
"devDependencies": {
Expand Down
36 changes: 26 additions & 10 deletions src/fileAccessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,45 @@ import * as vscode from 'vscode'
export const workspaceFileAccessor: FileAccessor = {
isWindows: typeof process !== 'undefined' && process.platform === 'win32',
readFile(path: string): Promise<Uint8Array> {
const uri = pathToUri(path)
const uri = vscode.Uri.file(path)
return thenableToPromise(vscode.workspace.fs.readFile(uri))
},
writeFile(path: string, contents: Uint8Array): Promise<void> {
const uri = pathToUri(path)
const uri = vscode.Uri.file(path)
return thenableToPromise(vscode.workspace.fs.writeFile(uri, contents))
},
basename(path: string): string {
const uri = pathToUri(path)
const uri = vscode.Uri.file(path)
const lastSlash = uri.path.lastIndexOf('/')
if (lastSlash === -1) {
return path
}
return uri.path.substring(lastSlash + 1)
},
}
filePathRelativeTo(base: string, filePath: string): string {
// Check if filePath is an absolute path
if (this.isWindows) {
if (filePath.match(/^[a-zA-Z]:\\/)) {
return filePath
}
} else {
if (filePath.startsWith('/')) {
return filePath
}
}

// Create a Uri object with the base path
let baseUri = vscode.Uri.file(base)
if (!baseUri.path.endsWith('/')) {
// If the base path is not a directory, get its parent directory
baseUri = vscode.Uri.joinPath(baseUri, '..')
}

// Resolve the file path against the base Uri
const fullUri = vscode.Uri.joinPath(baseUri, filePath)

function pathToUri(path: string) {
try {
return vscode.Uri.file(path)
} catch (e) {
return vscode.Uri.parse(path, true)
}
return fullUri.fsPath
},
}

function thenableToPromise<T>(t: Thenable<T>): Promise<T> {
Expand Down

0 comments on commit 183a8a5

Please sign in to comment.