-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance #3
base: master
Are you sure you want to change the base?
Maintenance #3
Changes from 20 commits
2c09301
469a11d
2d9d299
df8b303
931f920
e0af173
84bcfff
07096d9
9998b37
fe5f264
e251402
e892696
e4d9c09
fbf1189
21cdfa7
9cdd4cd
08f8f17
f6a296a
1cbbe88
15ba149
ff1524b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
decls |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "steelbrain", | ||
"rules": { | ||
"no-param-reassign": 0, | ||
"no-duplicate-imports": 0, | ||
"import/prefer-default-export": 0 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
[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 | ||
|
||
[options] | ||
module.system=node |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
.DS_Store |
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @philippvr |
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 | ||
|
||
test: | ||
override: | ||
- npm test | ||
|
||
machine: | ||
node: | ||
version: 6.3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably fine to just go with |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* @flow */ | ||
|
||
declare var atom: Object; | ||
declare module 'atom' { | ||
declare var Point: any; | ||
declare var Range: any; | ||
declare var Panel: any; | ||
declare var TextEditor: any; | ||
declare var TextBuffer: any; | ||
declare var BufferMarker: any; | ||
declare var TextEditorGutter: any; | ||
declare var TextEditorMarker: any; | ||
declare var CompositeDisposable: any; | ||
declare var Disposable: any; | ||
declare var Emitter: any; | ||
} |
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; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use babel' | ||
|
||
/* @flow */ | ||
|
||
import Breakpoint from './breakpoint' | ||
import BreakpointEvent from './breakpoint-event' | ||
import DebuggerController from './debugger-controller' | ||
import SessionEvent from './session-event' | ||
import TargetEvent from './target-event' | ||
import type { Debugger, DebuggerView } from './types' | ||
import { Disposable } from 'atom' | ||
|
||
module.exports = { | ||
instance: DebuggerController, | ||
|
||
activate(): void { | ||
this.instance = new DebuggerController() | ||
require('atom-package-deps').install('debugger') // eslint-disable-line | ||
}, | ||
|
||
provideEventDefs(): Object { | ||
return { | ||
'BreakpointEvent': BreakpointEvent, | ||
'SessionEvent': SessionEvent, | ||
'TargetEvent': TargetEvent | ||
} | ||
}, | ||
|
||
consumeView(view: DebuggerView): Disposable { | ||
this.instance.addView(view) | ||
|
||
return new Disposable(() => { | ||
this.instance.deleteView(view) | ||
}) | ||
}, | ||
|
||
consumeDebugger(debug: Debugger): Disposable { | ||
this.instance.addDebugger(debug) | ||
|
||
return new Disposable(() => { | ||
this.instance.deleteDebugger(debug) | ||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use babel' | ||
|
||
/* @flow */ | ||
|
||
import DebuggerController from './debugger-controller' | ||
import Breakpoint from './breakpoint' | ||
|
||
import type { StackFrame } from './stack-frame' | ||
import type { Variable } from './variable' | ||
|
||
export type DebuggerTarget = { | ||
filePath: string, | ||
arguments: ?string | ||
} | ||
|
||
export type DebuggerView = { | ||
|
||
activate(controller: DebuggerController): void, | ||
|
||
dispose(): void | ||
} | ||
|
||
export type Debugger = { | ||
|
||
name(): string, | ||
|
||
onSessionEvent(callback: Function): void, | ||
|
||
onBreakpointEvent(callback: Function): void, | ||
|
||
onTargetEvent(callback: Function): void, | ||
|
||
start(target: DebuggerTarget): void, | ||
|
||
stop(): void, | ||
|
||
resume(): void, | ||
|
||
pause(): void, | ||
|
||
stepInto(): void, | ||
|
||
stepOver(): void, | ||
|
||
insertBreakpoint(breakpoint: Breakpoint): void, | ||
|
||
getCallStack(): Promise<Array<StackFrame>>, | ||
|
||
getSelectedFrame(): Promise<StackFrame>, | ||
|
||
setSelectedFrame(level: number): void, | ||
|
||
getVariableList(): Promise<Array<Variable>> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* @flow */ | ||
|
||
import { CompositeDisposable, Emitter } from 'atom' | ||
import type DebuggerDelegate from './delegate' | ||
|
||
export default class Commands { | ||
active: ?DebuggerDelegate; | ||
emitter: Emitter; | ||
subscriptions: CompositeDisposable; | ||
|
||
constructor() { | ||
this.active = null | ||
this.emitter = new Emitter() | ||
this.subscriptions = new CompositeDisposable() | ||
|
||
this.subscriptions.add(this.emitter) | ||
} | ||
activate() { | ||
this.subscriptions.add(atom.commands.add('atom-text-editor:not([mini])', { | ||
'debugger:start': () => this.start(), | ||
'debugger:stop': () => this.stop(), | ||
})) | ||
} | ||
start() { | ||
if (this.active) { | ||
return | ||
} | ||
const delegate = this.requestDelegate() | ||
if (!delegate) { | ||
return | ||
} | ||
this.active = delegate | ||
this.active.start() | ||
} | ||
stop() { | ||
if (this.active) { | ||
this.active.stop() | ||
this.emitter.emit('did-stop', this.active) | ||
this.active = null | ||
} | ||
} | ||
requestDelegate(): ?DebuggerDelegate { | ||
const event = { delegate: null } | ||
this.emitter.emit('request-delegate', event) | ||
return event.delegate | ||
} | ||
onShouldProvideDelegate(callback: (() => ?DebuggerDelegate)): void { | ||
this.emitter.on('request-delegate', function(event) { | ||
event.delegate = event.delegate || callback() | ||
}) | ||
} | ||
onDidStart(callback: ((delegate: DebuggerDelegate) => any)): void { | ||
this.emitter.on('did-start', callback) | ||
} | ||
onDidStop(callback: ((delegate: DebuggerDelegate) => any)): void { | ||
this.emitter.on('did-stop', callback) | ||
} | ||
dispose() { | ||
if (this.active) { | ||
this.stop() | ||
} | ||
this.subscriptions.dispose() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* @flow */ | ||
|
||
import { CompositeDisposable } from 'atom' | ||
|
||
import DebuggerDelegate from './delegate' | ||
import validateDebugger from './validate/debugger' | ||
import type { Debugger } from './types' | ||
|
||
export default class DelegateRegistry { | ||
delegates: Set<DebuggerDelegate>; | ||
subscriptions: CompositeDisposable; | ||
|
||
constructor() { | ||
this.delegates = new Set() | ||
this.subscriptions = new CompositeDisposable() | ||
} | ||
register(debugProvider: Debugger): DebuggerDelegate { | ||
if (validateDebugger(debugProvider)) { | ||
throw new Error('Invalid debugger provided') | ||
} | ||
const delegate = new DebuggerDelegate(debugProvider) | ||
this.delegates.add(delegate) | ||
delegate.onDidDestroy(() => { | ||
this.delegates.delete(delegate) | ||
}) | ||
return delegate | ||
} | ||
dispose() { | ||
for (const delegate of this.delegates) { | ||
delegate.dispose() | ||
} | ||
this.subscriptions.dispose() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* @flow */ | ||
|
||
import { Emitter, CompositeDisposable } from 'atom' | ||
import type { Debugger } from './types' | ||
|
||
export default class DebuggerDelegate { | ||
emitter: Emitter; | ||
provider: Debugger; | ||
subscriptions: CompositeDisposable; | ||
|
||
constructor(provider: Debugger) { | ||
this.provider = provider | ||
this.emitter = new Emitter() | ||
this.subscriptions = new CompositeDisposable() | ||
|
||
this.subscriptions.add(this.emitter) | ||
} | ||
get(): Debugger { | ||
return this.provider | ||
} | ||
// Real stuff -- starts | ||
start() { | ||
console.log('start debugger') | ||
} | ||
stop() { | ||
console.log('stop debugger') | ||
} | ||
// Real stuff -- ends | ||
onDidDestroy(callback: (() => any)) { | ||
return this.emitter.on('did-destroy', callback) | ||
} | ||
dispose() { | ||
if (this.subscriptions.isDisposed()) { | ||
return | ||
} | ||
this.emitter.emit('did-destroy') | ||
this.subscriptions.dispose() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* @flow */ | ||
|
||
import { CompositeDisposable, Disposable } from 'atom' | ||
import type { TextEditor } from 'atom' | ||
|
||
export default class Editor { | ||
textEditor: TextEditor; | ||
subscriptions: CompositeDisposable; | ||
|
||
constructor(textEditor: TextEditor) { | ||
this.textEditor = textEditor | ||
this.subscriptions = new CompositeDisposable() | ||
} | ||
onDidDestroy(callback: (() => any)): Disposable { | ||
const subscription = this.textEditor.onDidDestroy(callback) | ||
const disposable = new Disposable(() => { | ||
subscription.dispose() | ||
this.subscriptions.remove(disposable) | ||
}) | ||
this.subscriptions.add(disposable) | ||
return disposable | ||
} | ||
dispose() { | ||
this.subscriptions.dispose() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0
->"off"
😛