Skip to content
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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
decls
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"
}
}
16 changes: 2 additions & 14 deletions .flowconfig
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
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)
Copy link
Member Author

Choose a reason for hiding this comment

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


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
20 changes: 20 additions & 0 deletions circle.yml
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
16 changes: 16 additions & 0 deletions decls/atom.js
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;
}
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;
12 changes: 0 additions & 12 deletions interface/atom.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions lib-old/index.js
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)
})
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 54 additions & 0 deletions lib-old/types.js
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>>
}
File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions lib/commands.js
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()
}
}
34 changes: 34 additions & 0 deletions lib/delegate-registry.js
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()
}
}
39 changes: 39 additions & 0 deletions lib/delegate.js
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()
}
}
26 changes: 26 additions & 0 deletions lib/editor.js
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()
}
}
Loading