Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
decls
spec
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "steelbrain",
"rules": {
"no-param-reassign": "off",
"no-duplicate-imports": "off",
"import/prefer-default-export": "off"
}
}
25 changes: 11 additions & 14 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
[ignore]
node_modules/**/.*

[include]

[libs]
interface
node_modules/flow-atom-api/sig/v1.7.4
node_modules/flow-atom-api/node_modules/flow-json/sig
node_modules/flow-atom-api/node_modules/flow-json-schema/sig
node_modules/flow-atom-api/node_modules/flow-atom-event-kit/sig/v1.5.0
node_modules/flow-atom-api/node_modules/flow-atom-first-mate/sig/v5.1.1
node_modules/flow-atom-api/node_modules/flow-atom-keymap/sig/v6.3.2
node_modules/flow-atom-api/node_modules/flow-atom-node/sig
node_modules/flow-atom-api/node_modules/flow-atom-oniguruma/sig/v6.1.0
node_modules/flow-atom-api/node_modules/flow-atom-pathwatcher/sig/v6.2.4
node_modules/flow-atom-api/node_modules/flow-atom-text-buffer/sig/v8.5.0
node_modules/flow-atom-api/node_modules/flow-electron-api/sig/v1.1.1
node_modules/flow-atom-api/node_modules/iflow-jquery/index.js.flow
decls
node_modules/@flow-atom/atom/sig/v1.8.0/
node_modules/@flow-atom/keymap/sig/v6.3.2/
node_modules/@flow-atom/electron/sig/v0.37.8/
node_modules/@flow-atom/oniguruma/sig/v6.1.0/
node_modules/@flow-atom/event-kit/sig/v2.0.0/
node_modules/@flow-atom/pathwatcher/sig/v6.7.0/
node_modules/@flow-atom/first-mate/sig/v5.1.1/
node_modules/@flow-atom/text-buffer/sig/v9.2.2/
node_modules/iflow-jquery/index.js.flow

[options]
module.system=node
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.DS_Store
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Philipp von Radziewsky
Copyright (c) 2016 AtomDebugger Team (Philipp von Radziewsky & Steel Brain)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 21 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies:
override:
- curl -L https://atom.io/download/deb -o atom-amd64.deb
- sudo dpkg --install atom-amd64.deb || true
- sudo apt-get update
- sudo apt-get -f install
- node --version
- npm --version
- atom --version
- npm prune
- npm install
- apm rebuild
- npm build

test:
override:
- npm test

machine:
node:
version: 6
File renamed without changes.
9 changes: 9 additions & 0 deletions decls/jasmine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* @flow */

declare function it(name: string, callback: (() => void)): void;
declare function fit(name: string, callback: (() => void)): void;
declare function expect(value: any): Object;
declare function describe(name: string, callback: (() => void)): void;
declare function fdescribe(name: string, callback: (() => void)): void;
declare function beforeEach(callback: (() => void)): void;
declare function afterEach(callback: (() => void)): void;
19 changes: 9 additions & 10 deletions lib/breakpoint-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

import Breakpoint from './breakpoint'

export type BreakpointEventType = 'inserted' | 'removed' | 'enabled' |
'disabled' | 'moved' |
'condition-added' | 'condition-removed'
export type BreakpointEventType = 'inserted' | 'removed' | 'enabled' |
'disabled' | 'moved' |
'condition-added' | 'condition-removed'

export default class BreakpointEvent {
type: BreakpointEventType;
type: BreakpointEventType;
breakpoint: Breakpoint;
bufferRow: ?number;
bufferRow: ?number;

constructor(
type: BreakpointEventType, breakpoint: Breakpoint, bufferRow?: number) {

this.type = type
constructor(type: BreakpointEventType,
breakpoint: Breakpoint,
bufferRow?: number) {
this.type = type
this.breakpoint = breakpoint

if (type === 'moved') {

if (bufferRow == null || typeof bufferRow !== 'number') {
throw new Error('bufferRow must be a number')
}
Expand Down
24 changes: 10 additions & 14 deletions lib/breakpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
/* @flow */

export type FunctionBreakpoint = { function: string }
export type LineBreakpoint = { filePath: string, bufferRow: number }
export type LineBreakpoint = { filePath: string, bufferRow: number }
export type BreakpointLocation = LineBreakpoint | FunctionBreakpoint

export default class Breakpoint {
location: BreakpointLocation;
enabled: boolean;
condition: ?string;
location: BreakpointLocation;
enabled: boolean;
condition: ?string;
activeBufferRow: ?number;

constructor(location: BreakpointLocation, condition?: string) {

if (!location.function && (!location.filePath || !location.bufferRow)) {
throw new TypeError('location must be BreakpointLocation')
}

this.location = location
this.condition = (condition) ? condition : null
this.enabled = true
this.location = location
this.condition = condition || null
this.enabled = true
this.activeBufferRow = null
}

Expand All @@ -33,14 +32,12 @@ export default class Breakpoint {
}

equals(other: Breakpoint): bool {

if (this.location.function && other.location.function) {

return (this.location.function === other.location.function)
} else if (this.location.filePath && other.location.filePath) {
const same_file = (this.location.filePath === other.location.filePath)
const sameFile = (this.location.filePath === other.location.filePath)

if (same_file && this.location.bufferRow && other.location.bufferRow) {
if (sameFile && this.location.bufferRow && other.location.bufferRow) {
return (this.location.bufferRow === other.location.bufferRow)
}
}
Expand All @@ -49,9 +46,8 @@ export default class Breakpoint {
}

toHumanized(): string {

if (this.location.filePath && this.location.bufferRow) {
return this.location.filePath + ':' + (this.location.bufferRow+1)
return `${this.location.filePath}:${this.location.bufferRow + 1}`
}

return '?'
Expand Down
36 changes: 15 additions & 21 deletions lib/debugger-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

/* @flow */

import Breakpoint from './breakpoint'
import DebuggerRegistry from './debugger-registry'
import ProjectConfig from './project-config'
import ViewRegistry from './view-registry'
import Breakpoint from './breakpoint'
import DebuggerRegistry from './debugger-registry'
import ProjectConfig from './project-config'
import ViewRegistry from './view-registry'

import type { Debugger, DebuggerView } from './types'

export default class DebuggerController {
debuggerRegistry: DebuggerRegistry;
viewRegistry: ViewRegistry;
viewRegistry: ViewRegistry;

constructor() {
this.debuggerRegistry = new DebuggerRegistry()
this.viewRegistry = new ViewRegistry(this)
this.viewRegistry = new ViewRegistry(this)

atom.commands.add('atom-text-editor', {
'debugger:start': () => { this.start() },
Expand All @@ -24,7 +24,7 @@ export default class DebuggerController {
'debugger:pause': () => { this.pause() },
'debugger:step-into': () => { this.stepInto() },
'debugger:step-over': () => { this.stepOver() },
'debugger:toggle-breakpoint-at-current-line': () => { this.toggleBreakpoint() }
'debugger:toggle-breakpoint-at-current-line': () => { this.toggleBreakpoint() },
})
}

Expand All @@ -33,7 +33,7 @@ export default class DebuggerController {
}

addView(view: DebuggerView): void {
this.viewRegistry.add(view);
this.viewRegistry.add(view)
}

deleteView(view: DebuggerView): void {
Expand All @@ -42,46 +42,40 @@ export default class DebuggerController {

/* Commands */
start(): void {
let proxy = this.debuggerRegistry.getDebuggerProxy()
let config
const proxy = this.debuggerRegistry.getDebuggerProxy()

if (proxy.getActiveDebugger() != null) {

atom.notifications.addError(
'There is a session in progress. Please, exit first.')

return
}

config = new ProjectConfig()
const config = new ProjectConfig()
config.tryLoad()

if (!config.data) {

atom.notifications.addError('The project has no config.')

return
}

if (!config.data.target) {

atom.notifications.addError('The project has no target set.')

return
}

if (!config.data.debugger) {

atom.notifications.addError('The project has no debugger set.')

return
}

const target = config.data.target
const debug = this.debuggerRegistry.get(config.data.debugger)
const debug = this.debuggerRegistry.get(config.data.debugger)

if (!debug) {

atom.notifications.addFatalError('The debugger is unknown.')

return
Expand Down Expand Up @@ -117,14 +111,14 @@ export default class DebuggerController {
return
}

let breakpoint = new Breakpoint({
filePath: activeEditor.getPath(),
bufferRow: activeEditor.getCursorBufferPosition().row
const breakpoint = new Breakpoint({
filePath: activeEditor.getPath(),
bufferRow: activeEditor.getCursorBufferPosition().row,
})

const debug = this.debuggerRegistry.getDebuggerProxy()

if (debug.removeBreakpoint(breakpoint) == false) {
if (debug.removeBreakpoint(breakpoint) === false) {
debug.insertBreakpoint(breakpoint)
}
}
Expand Down
Loading