Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Fix: Debug no source file #229

Merged
merged 8 commits into from
Oct 10, 2022
Merged

Fix: Debug no source file #229

merged 8 commits into from
Oct 10, 2022

Conversation

xhulz
Copy link
Contributor

@xhulz xhulz commented Sep 26, 2022

PR description

ref: #54

Truffle does not have the option to inform the source list as a parameter which makes impossible to resolve any locations from the compilation artefacts (ref: trufflesuite/truffle#3800). Even retrieving the artefacts from the build folder, it's not possible to re-create the location references in the right way. To avoid that, we need to compile the contracts again and get the list of shim compilations before starts any debug session.

Compiling every time (before debug) slows the process down a bit, so IMHO, in the future we can do:

  • Use the Truffle DB as mentioned here Add sourcelist parameter to build artifacts truffle#3800.
  • Stopping using NPX to do the migrations and start doing these ones directly through the truffle library, so we can store the builds locally and avoid recompiling each time before the debug process.

@kevinbluer as we said, this was created as a Draft.

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if documentation updates are required.

@xhulz xhulz added the bug Something isn't working label Sep 26, 2022
Copy link
Contributor

@michaeljohnbennett michaeljohnbennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good!

Well done on refactoring this stuff. Be good to hear your thoughts on the namespace v's exports side of things too.

src/debugAdapter/contracts/contractHelpers.ts Outdated Show resolved Hide resolved
@xhulz
Copy link
Contributor Author

xhulz commented Sep 29, 2022

Hey @michaeljohnbennett!

I just removed the Contract Helper namespace and left it using the export way. Henceforth, I'll use only exports and all namespaces I find on the way, I'll change

Thank you!

Copy link
Contributor

@acuarica acuarica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +1 to +29
// Copyright (c) Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.
declare module '@truffle/workflow-compile' {
import type {Compilation, CompiledContract} from '@truffle/compile-common';

interface Artifacts {
/**
* An list of codec-style compilations; this method of specifying a project
* is mostly intended for internal Truffle use for now, but you can see the
* documentation of the Compilation type if you want to use it.
*/
compilations: Array<Compilation>;
/**
* A list of contracts involved in the compilation.
*/
contracts: Array<CompiledContract>;
}

/**
* Compiles contracts found in contracts_directory and
* saves them in contracts_build_directory
*
* @param {TruffleConfig} config - from '@truffle/config' - Config.detect({ workingDirectory: workingDirectory })
* @return {Artifacts}
*/
function compile(config: TruffleConfig): Promise<Artifacts>;

export {Artifacts, compile};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to start sending type definitions to the respective truffle packages, instead of adding them here?

@gnidan @kevinbluer

src/debugAdapter/runtimeInterface.ts Outdated Show resolved Hide resolved
src/debugAdapter/runtimeInterface.ts Outdated Show resolved Hide resolved
src/debugAdapter/contracts/contractHelpers.ts Outdated Show resolved Hide resolved
@xhulz
Copy link
Contributor Author

xhulz commented Sep 30, 2022

Ok @acuarica,

Your suggestions have been implemented

Thank you

@xhulz xhulz marked this pull request as ready for review October 7, 2022 14:58
@kevinbluer
Copy link
Member

Quick review from my side and a bunch of additional testing on a number of contracts (some of which had issues) and all looking good! Nice work @xhulz 👍

@xhulz xhulz merged commit 2b93030 into develop Oct 10, 2022
@xhulz xhulz deleted the fixed/debug-no-source-file branch October 10, 2022 08:08
xhulz added a commit that referenced this pull request Oct 27, 2022
* Dedicated tab(s) in VS Code panel (#205)

* feat: implementing the new truffle panel log

* build: multi tab has been implemented

* build: dead code has been removed

* build: dispose tab and onview activation has implemented

* refactor: main.js has converted to object

* docs: ts documentation and code comments has been added

* fix: code review resolutions

* fix: required.test has been fixed

* fix: change gfx (#215)

Bryan supplied a revised logo image san's dropshadow.

* Remove redundant txns from dialog after a redeploy (#225)

fix: the debug transaction dropdown is now showing only the last deployed transaction

* New solidity project types has added: empty, sample and unbox a truffle project (#222)

* feat: new types of project were added to create a new project

* fix: folder projectPath has been vanish out

* Networks (Local Instance) - Get More Information (#217)

* feat: saving progress

* feat: saving the progress

* feat: saving the progress

* feat: it has been created the option to get details for ganache instances

* fix: problems pointed out in the code review have been fixed

Co-authored-by: MB <951378+michaeljohnbennett@users.noreply.github.com>

* Fix/directory selection flow (#226)

* feat: new types of project were added to create a new project

* fix: folder projectPath has been vanish out

* fix: the directory selection has moved to the end of the flow

* fix: truffle box sample project name variable has changed

* Dropdown when selecting a box to "unbox" (#220)

chore: the textbox has been replaced by a dropdown with the list of boxes

* Create an "auto-deploy on save" toggle in the Contract Explorer (#227)

* chore: saving the progress

* chore: status bar for auto deploy was placed on vscode environment

* chore: auto deploy action has been implemented for contracts

* fix: remove auto focus from log panel (#233)

fix: auto focus from log panel has been removed

* Fix: Debug no source file (#229)

* fix: truffle compile has been added to gather the artifacts compilation in correct way

* fix: drizzle has been removed from truffle boxes list

* docs: the typescript docs has been created

* fix: typo

* fix: pretting missing code

* fix: references no longer used have been removed

* fix: namespace from contract helpers has been removed

* fix: suggestions from code review have been implemented

* Spurious closing bracket on "Create sample project" entry when creating a new project (#238)

fix: the sample project description text has been fixed

* Temporarily continue logging to the Truffle for VS Code output channel (#237)

* chore: logging using output channels has been implemented again

* fix: auto focus has been removed from log create and log dispose

* fix: the focus on output channels has been restaured

* fix: minor stylistic tweaks to output tabs (#240)

* fix: minor stylistic tweaks to output tabs

* fix: output tab accommodations for light(er) modes

* Changelog has been updated with new features (#242)

* chore: changelog has been updated with new features

* fix: text has been changed

* Fix: original-require package issues (#243)

fix: webpack has been updated to solve the problem with original-require package

* Fix: Webpack options (#245)

fix: devtool has changed to eval instead source-map

Co-authored-by: MB <951378+michaeljohnbennett@users.noreply.github.com>
Co-authored-by: Kevin Bluer <kevin@bluer.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants