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

Commit

Permalink
Always use the embedded Debug Adapter (#218)
Browse files Browse the repository at this point in the history
fix: always use the embedded debug adapter
  • Loading branch information
acuarica authored Sep 5, 2022
1 parent 182eeb2 commit 12569d7
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 58 deletions.
1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ out/**
!out/src/Nethereum.Generators.DuoCode.js
!out/src/extension.js
!out/src/debugger.js
!out/src/web3ProviderResolver.js
!out/src/checkTruffleConfigTemplate.js
src/**
test/**
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@
{
"type": "truffle",
"label": "Truffle - Debugger",
"program": "./out/src/debugger.js",
"runtime": "node",
"configurationAttributes": {
"launch": {
Expand Down Expand Up @@ -700,7 +699,7 @@
"webpack:dev": "webpack --config webpack.dev.js",
"webpack:prod": "webpack --config webpack.prod.js",
"watch:webpack": "webpack --watch --config webpack.dev.js",
"copyFiles": "copyfiles -V -f ./src/debugAdapter/web3ProviderResolver.js ./src/helpers/checkTruffleConfigTemplate.js ./out/src/ ",
"copyFiles": "copyfiles -V -f ./src/helpers/checkTruffleConfigTemplate.js ./out/src/",
"watch:tsc": "tsc-watch --onCompilationComplete \"yarn copyFiles\" ",
"watch": "yarn watch:tsc",
"prettier": "prettier --check .",
Expand Down
10 changes: 4 additions & 6 deletions src/debugAdapter/configuration/debuggerConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

import {debug, ExtensionContext} from 'vscode';
import {DEBUG_TYPE, EMBED_DEBUG_ADAPTER} from '../constants/debugAdapter';
import {DEBUG_TYPE} from '../constants/debugAdapter';
import DebugAdapterTrackerFactory from '../debugAdapterTracker/debugAdapterTrackerFactory';
import DebugAdapterDescriptorFactory from './debugAdapterDescriptorFactory';
import DebuggerConfigurationProvider from './debugConfigurationProvider';
Expand All @@ -12,11 +12,9 @@ export class DebuggerConfiguration {
const debugConfigProvider = new DebuggerConfigurationProvider();
context.subscriptions.push(debug.registerDebugConfigurationProvider(DEBUG_TYPE, debugConfigProvider));

if (EMBED_DEBUG_ADAPTER) {
const factory = new DebugAdapterDescriptorFactory();
context.subscriptions.push(debug.registerDebugAdapterDescriptorFactory(DEBUG_TYPE, factory));
context.subscriptions.push(factory);
}
const factory = new DebugAdapterDescriptorFactory();
context.subscriptions.push(debug.registerDebugAdapterDescriptorFactory(DEBUG_TYPE, factory));
context.subscriptions.push(factory);

const debugAdapterTrackerFactory = new DebugAdapterTrackerFactory();
const trackerFactory = debug.registerDebugAdapterTrackerFactory(DEBUG_TYPE, debugAdapterTrackerFactory);
Expand Down
2 changes: 0 additions & 2 deletions src/debugAdapter/constants/debugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ export const EVALUATE_REQUEST_TYPES = {

export const DEBUG_TYPE = 'truffle';

export const EMBED_DEBUG_ADAPTER = typeof IS_BUNDLE_TIME === 'undefined' || IS_BUNDLE_TIME === false;

export const ERROR_MESSAGE_ID = 1;
2 changes: 1 addition & 1 deletion src/debugAdapter/debugNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {showQuickPick} from '@/helpers/userInteraction';
import {QuickPickItem} from 'vscode';
import {LocalProject} from '@/Models/TreeItems/LocalProject';
import {LocalNetworkNode} from '@/Models/TreeItems';
import {ConfigurationReader} from './configurationReader';
import {ConfigurationReader} from '../helpers/debugConfigurationReader';

export class DebugNetwork {
public workingDirectory: string;
Expand Down
4 changes: 0 additions & 4 deletions src/debugAdapter/types/webpackVariables.d.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/debugAdapter/web3ProviderResolver.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/debugger.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {generate} from 'astring';
import ESTree from 'estree';
import fs from 'fs-extra';
import path from 'path';
import {tryExecuteCommandInFork} from './cmdCommandExecutor';
import {tryExecuteCommandInFork} from '../debugAdapter/cmdCommandExecutor';
import {IConfiguration, INetwork, INetworkOption, IProvider} from '@/helpers/ConfigurationReader';

const truffleConfigRequireNames = {
Expand Down Expand Up @@ -134,10 +134,7 @@ export namespace ConfigurationReader {
}

async function getTruffleMetadata(workingDirectory: string): Promise<IConfiguration> {
const truffleConfigTemplatePath =
typeof IS_BUNDLE_TIME === 'undefined' || IS_BUNDLE_TIME === false
? path.join(__dirname, '..', 'helpers', 'checkTruffleConfigTemplate.js')
: path.join(__dirname, 'checkTruffleConfigTemplate.js');
const truffleConfigTemplatePath = path.join(__dirname, 'checkTruffleConfigTemplate.js');
const truffleConfigPath = 'truffle-config.js';

const result = await tryExecuteCommandInFork(workingDirectory, truffleConfigTemplatePath, truffleConfigPath);
Expand Down
12 changes: 1 addition & 11 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ module.exports = {
target: 'node',
entry: {
extension: './src/extension.ts',
debugger: './src/debugger.ts',
},
output: {
path: path.join(__dirname, 'out', 'src'),
filename: '[name].js',
libraryTarget: 'commonjs2',
},
optimization: {
minimize: true,
},
externals: function ({context, request}, callback) {
if (/^vscode$/.test(request)) {
return callback(null, 'commonjs ' + request);
Expand Down Expand Up @@ -52,13 +48,7 @@ module.exports = {
},
plugins: [
new CopyPlugin({
patterns: [
{from: './src/debugAdapter/web3ProviderResolver.js', to: './'},
{from: './src/helpers/checkTruffleConfigTemplate.js', to: './'},
],
}),
new webpack.DefinePlugin({
IS_BUNDLE_TIME: true,
patterns: [{from: './src/helpers/checkTruffleConfigTemplate.js', to: './'}],
}),
],
node: {
Expand Down
3 changes: 3 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
optimization: {
minimize: true,
},
});

0 comments on commit 12569d7

Please sign in to comment.