├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── assets ├── breakpoint-preview.png ├── configuration.png ├── console.png ├── debug-area-preview.png ├── preview-one.png ├── preview.png ├── preview.sketch └── toolbar-preview.png ├── icons ├── arrow-down.svg ├── arrow-right.svg ├── breakpoint.svg ├── collapse-in.svg ├── collapse-out.svg ├── continue.svg ├── icons.sketch ├── panel-bottom.svg ├── panel-right.svg ├── pause.svg ├── refresh.svg ├── run.svg ├── select.svg ├── status-error.svg ├── status-success.svg ├── status-warning.svg ├── step-into.svg ├── step-out.svg ├── step-over.svg └── stop.svg ├── index.d.ts ├── keymaps └── xatom-debug.json ├── lib ├── Expression.js ├── Expression.js.map ├── GroupView.js ├── GroupView.js.map ├── Location.js ├── Location.js.map ├── Package.js ├── Package.js.map ├── Project.js ├── Project.js.map ├── SchemeEditorView.js ├── SchemeEditorView.js.map ├── ToolbarView.js ├── ToolbarView.js.map ├── View.js ├── View.js.map ├── XAtom.js ├── XAtom.js.map ├── XAtomDebug.js ├── XAtomDebug.js.map ├── breakpoint │ ├── Breakpoint.js │ ├── Breakpoint.js.map │ ├── BreakpointManager.js │ ├── BreakpointManager.js.map │ ├── BreakpointNavigatorView.js │ ├── BreakpointNavigatorView.js.map │ ├── BreakpointView.js │ ├── BreakpointView.js.map │ ├── index.js │ └── index.js.map ├── debug │ ├── CallFrame.js │ ├── CallFrame.js.map │ ├── DebugAreaView.js │ ├── DebugAreaView.js.map │ ├── DebugControlView.js │ ├── DebugControlView.js.map │ ├── DebugFrameView.js │ ├── DebugFrameView.js.map │ ├── DebugNavigatorView.js │ ├── DebugNavigatorView.js.map │ ├── Variable.js │ ├── Variable.js.map │ ├── index.js │ └── index.js.map ├── plugin │ ├── Plugin.js │ ├── Plugin.js.map │ ├── PluginManager.js │ ├── PluginManager.js.map │ ├── PluginSession.js │ ├── PluginSession.js.map │ ├── index.js │ └── index.js.map └── storage │ ├── Collection.js │ ├── Collection.js.map │ ├── Item.js │ ├── Item.js.map │ ├── Storage.js │ ├── Storage.js.map │ ├── index.js │ └── index.js.map ├── menus └── xatom-debug.json ├── package.json ├── src ├── ConsoleView.ts ├── DebugAreaView.ts ├── ExpressionManager.ts ├── InspectorView.ts ├── SchemeView.ts ├── ToolbarView.ts ├── XAtomDebug.ts ├── editor │ ├── BreakpointManager.ts │ ├── EditorManager.ts │ └── index.ts ├── element │ ├── button.ts │ ├── element.ts │ ├── events.ts │ ├── icon.ts │ ├── index.ts │ ├── input.ts │ └── select.ts ├── greet.ts ├── main.ts ├── person.ts ├── plugin │ ├── PluginClient.ts │ ├── PluginManager.ts │ └── index.ts ├── storage.ts └── test.ts ├── src2 ├── Expression.ts ├── GroupView.ts ├── Location.ts ├── Package.ts ├── Project.ts ├── SchemeEditorView.ts ├── ToolbarView.ts ├── View.ts ├── XAtom.ts ├── XAtomDebug.ts ├── breakpoint │ ├── Breakpoint.ts │ ├── BreakpointManager.ts │ ├── BreakpointNavigatorView.ts │ ├── BreakpointView.ts │ └── index.ts ├── debug │ ├── CallFrame.ts │ ├── DebugAreaView.ts │ ├── DebugControlView.ts │ ├── DebugFrameView.ts │ ├── DebugNavigatorView.ts │ ├── Variable.ts │ └── index.ts ├── plugin │ ├── Plugin.ts │ ├── PluginManager.ts │ ├── PluginSession.ts │ └── index.ts └── storage │ ├── Collection.ts │ ├── Item.ts │ ├── Storage.ts │ └── index.ts ├── styles ├── xatom-debug-area.less ├── xatom-debug-breakpoint.less ├── xatom-debug-control.less ├── xatom-debug-frame.less ├── xatom-debug-icons.less ├── xatom-debug-location.less ├── xatom-debug-toolbar.less └── xatom-group.less ├── test ├── .xatom.json ├── lib │ ├── greet.js │ ├── greet.js.map │ ├── person.js │ ├── person.js.map │ ├── some │ │ └── really │ │ │ └── large │ │ │ └── path │ │ │ └── to │ │ │ └── display │ │ │ └── my │ │ │ └── file │ │ │ └── and │ │ │ ├── alsoalargefilenametotest.js │ │ │ └── alsoalargefilenametotest.js.map │ ├── test.js │ └── test.js.map ├── package-lock.json ├── package.json ├── src │ ├── greet.ts │ ├── person.ts │ ├── some │ │ └── really │ │ │ └── large │ │ │ └── path │ │ │ └── to │ │ │ └── display │ │ │ └── my │ │ │ └── file │ │ │ └── and │ │ │ └── alsoalargefilenametotest.ts │ └── test.ts └── tsconfig.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 - First Release 2 | 3 | * Every feature added 4 | * Every bug fixed 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Williams Medina 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XAtom Debug 2 | 3 | [![gitter](https://img.shields.io/gitter/room/xatom-debug/xatom-debug.svg?style=flat-square)](https://gitter.im/willyelm/xatom-debug?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [![apm](https://img.shields.io/apm/v/xatom-debug.svg?style=flat-square)](https://atom.io/packages/xatom-debug) 5 | [![apm](https://img.shields.io/apm/l/xatom-debug.svg?style=flat-square)](https://github.com/willyelm/atom-bug/blob/master/LICENSE.md) 6 | 7 | A Simple Debugging tool for Atom. `xatom-debug` is a base debugger UI provider, you will need additionally install a specific debugger for your language. 8 | 9 | ![preview](https://raw.githubusercontent.com/willyelm/xatom-debug/master/assets/preview.png) 10 | 11 | ### Installation 12 | 13 | ``` 14 | apm install xatom-debug 15 | ``` 16 | 17 | ### Features 18 | 19 | - `Toolbar`: Toolbar API allows to control the execution process, select and configure the selected plugin. 20 | 21 | ![feature](https://raw.githubusercontent.com/willyelm/xatom-debug/master/assets/toolbar-preview.png) 22 | 23 | - `Breakpoints`: Add, remove breakpoints by clicking on the file line. breakpoints are accessible from the `Debug Area` as well. 24 | 25 | ![feature](https://raw.githubusercontent.com/willyelm/xatom-debug/master/assets/breakpoint-preview.png) 26 | 27 | - `Debug Area`: Navigate the current scope status local and global variables, open the current call-stack functions and control the execution step. 28 | 29 | ![feature](https://raw.githubusercontent.com/willyelm/xatom-debug/master/assets/debug-area-preview.png) 30 | 31 | - `Configuration`: 32 | 33 | ### API Documentation 34 | 35 | on progress... 36 | 37 | ### Available Plugins 38 | 39 | Below is the list of available plugins so far: 40 | 41 | Package|Description 42 | ---|--- 43 | [NodeJS](https://atom.io/packages/xatom-debug-nodejs)|Run and debug javascript files using NodeJS 6.3+. 44 | [Google Chrome](https://atom.io/packages/xatom-debug-chrome)|Connect the debugger to a server enabling debugging javascript files. 45 | 46 | ### Requirements 47 | - atom 1.0.0+ 48 | 49 | ### License 50 | 51 | MIT 52 | -------------------------------------------------------------------------------- /assets/breakpoint-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/breakpoint-preview.png -------------------------------------------------------------------------------- /assets/configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/configuration.png -------------------------------------------------------------------------------- /assets/console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/console.png -------------------------------------------------------------------------------- /assets/debug-area-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/debug-area-preview.png -------------------------------------------------------------------------------- /assets/preview-one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/preview-one.png -------------------------------------------------------------------------------- /assets/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/preview.png -------------------------------------------------------------------------------- /assets/preview.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/preview.sketch -------------------------------------------------------------------------------- /assets/toolbar-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/assets/toolbar-preview.png -------------------------------------------------------------------------------- /icons/arrow-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /icons/arrow-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /icons/breakpoint.svg: -------------------------------------------------------------------------------- 1 | breakpoint -------------------------------------------------------------------------------- /icons/collapse-in.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/collapse-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/continue.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/icons.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/icons/icons.sketch -------------------------------------------------------------------------------- /icons/panel-bottom.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/panel-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/pause.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/refresh.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /icons/run.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /icons/select.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/status-error.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/status-success.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/status-warning.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/step-into.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/step-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/step-over.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /icons/stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace AtomCore { 2 | interface IWorkspace { 3 | addHeaderPanel(options:IWorkspacePanelOptions):Panel; 4 | getPaneItems(): any[]; 5 | getCenter(): any; 6 | toggle(uri:any): Q.Promise; 7 | hide(uri:any): Q.Promise; 8 | observePanes(cb: Function); 9 | observePaneItems(cb: Function); 10 | } 11 | interface IProject { 12 | getDirectories(): string[]; 13 | getPaths(): string[]; 14 | } 15 | interface IAtom { 16 | tooltips: any; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /keymaps/xatom-debug.json: -------------------------------------------------------------------------------- 1 | { 2 | "atom-workspace": { 3 | "ctrl-r": "xatom-debug:run", 4 | "ctrl-shift-s": "xatom-debug:stop", 5 | "ctrl-shift-e": "xatom-debug:resume", 6 | "ctrl-o": "xatom-debug:step-over", 7 | "ctrl-i": "xatom-debug:step-into", 8 | "ctrl-t": "xatom-debug:step-out", 9 | "ctrl-shift-d": "xatom-debug:toggle" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/Expression.js: -------------------------------------------------------------------------------- 1 | //# sourceMappingURL=Expression.js.map -------------------------------------------------------------------------------- /lib/Expression.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Expression.js","sourceRoot":"","sources":["../src2/Expression.ts"],"names":[],"mappings":"","sourcesContent":[""]} -------------------------------------------------------------------------------- /lib/GroupView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | /*! 12 | * XAtom Debug 13 | * Copyright(c) 2017 Williams Medina 14 | * MIT Licensed 15 | */ 16 | const { CompositeDisposable, Emitter, Disposable } = require('atom'); 17 | import { get, forEach, isEqual } from 'lodash'; 18 | import { View, ViewElement, Element } from './View'; 19 | let GroupView = class GroupView { 20 | constructor(viewElement, options) { 21 | this.viewElement = viewElement; 22 | this.options = options; 23 | this.groupItems = []; 24 | this.emitter = new Emitter(); 25 | this.element = this.getElement(); 26 | } 27 | removeItems() { 28 | if (this.contentElement) { 29 | this.contentElement.innerHTML = ''; 30 | } 31 | } 32 | getItem(data) { 33 | return this.groupItems.find((groupItem) => { 34 | return isEqual(groupItem.data, data); 35 | }); 36 | } 37 | removeItem(data) { 38 | const groupItem = this.getItem(data); 39 | if (groupItem) { 40 | groupItem.item.remove(); 41 | const index = this.groupItems.indexOf(groupItem); 42 | this.groupItems.splice(index, 1); 43 | } 44 | } 45 | activate(item) { 46 | this.groupItems.forEach((groupItem) => { 47 | if (groupItem === item) { 48 | groupItem.item.classList.add('active'); 49 | this.emitter.emit('didSelect', groupItem); 50 | } 51 | else { 52 | groupItem.item.classList.remove('active'); 53 | } 54 | }); 55 | } 56 | onDidSelect(cb) { 57 | return this.emitter.on('didSelect', cb); 58 | } 59 | addItem(item, data) { 60 | const groupItem = { 61 | item, 62 | data 63 | }; 64 | this.groupItems.push(groupItem); 65 | if (this.options.selectable) { 66 | item.addEventListener('click', () => this.activate(groupItem)); 67 | } 68 | this.contentElement.appendChild(groupItem.item); 69 | return groupItem; 70 | } 71 | viewDidLoad() { 72 | // 73 | this.headerElement.innerHTML = ` ${this.options.title} `; 74 | forEach(get(this, 'options.actions', []), (value, key) => { 75 | const button = document.createElement('button'); 76 | button.innerText = key.toString(); 77 | button.classList.add('btn'); 78 | button.addEventListener('click', () => value()); 79 | this.headerElement.appendChild(button); 80 | }); 81 | } 82 | getElement() { 83 | return this.viewElement.element; 84 | } 85 | }; 86 | __decorate([ 87 | Element('.xatom-group-body'), 88 | __metadata("design:type", HTMLButtonElement) 89 | ], GroupView.prototype, "contentElement", void 0); 90 | __decorate([ 91 | Element('.xatom-group-header'), 92 | __metadata("design:type", HTMLElement) 93 | ], GroupView.prototype, "headerElement", void 0); 94 | GroupView = __decorate([ 95 | View({ 96 | name: 'xatom-group', 97 | template: `
98 |
` 99 | }), 100 | __metadata("design:paramtypes", [ViewElement, Object]) 101 | ], GroupView); 102 | export { GroupView }; 103 | //# sourceMappingURL=GroupView.js.map -------------------------------------------------------------------------------- /lib/GroupView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"GroupView.js","sourceRoot":"","sources":["../src2/GroupView.ts"],"names":[],"mappings":"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","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\nconst { CompositeDisposable, Emitter, Disposable } = require('atom');\nimport { get, forEach, isEqual } from 'lodash';\nimport { View, ViewElement, Element } from './View';\nimport { CallFrame } from './debug';\n\nexport interface GroupViewOptions {\n title: string;\n selectable?: boolean;\n actions?: any;\n}\n\n@View({\n name: 'xatom-group',\n template: `
\n
`\n})\nexport class GroupView {\n public element: HTMLElement;\n private groupItems: any[] = [];\n private emitter = new Emitter();\n @Element('.xatom-group-body') contentElement: HTMLButtonElement;\n @Element('.xatom-group-header') headerElement: HTMLElement;\n constructor (\n private viewElement: ViewElement,\n private options: GroupViewOptions) {\n this.element = this.getElement();\n }\n removeItems () {\n if (this.contentElement){\n this.contentElement.innerHTML = '';\n }\n }\n getItem (data: any) {\n return this.groupItems.find((groupItem) => {\n return isEqual(groupItem.data, data);\n });\n }\n removeItem (data: any) {\n const groupItem = this.getItem(data);\n if (groupItem) {\n groupItem.item.remove();\n const index = this.groupItems.indexOf(groupItem);\n this.groupItems.splice(index, 1);\n }\n }\n activate (item) {\n this.groupItems.forEach((groupItem) => {\n if (groupItem === item) {\n groupItem.item.classList.add('active');\n this.emitter.emit('didSelect', groupItem);\n } else {\n groupItem.item.classList.remove('active');\n }\n });\n }\n onDidSelect (cb: Function) {\n return this.emitter.on('didSelect', cb);\n }\n addItem (item: HTMLElement, data: any) {\n const groupItem = {\n item,\n data\n }\n this.groupItems.push(groupItem);\n if (this.options.selectable) {\n item.addEventListener('click', () => this.activate(groupItem));\n }\n this.contentElement.appendChild(groupItem.item);\n return groupItem;\n }\n viewDidLoad () {\n // \n this.headerElement.innerHTML = ` ${this.options.title} `;\n forEach(get(this, 'options.actions', []), (value, key) => {\n const button = document.createElement('button');\n button.innerText = key.toString();\n button.classList.add('btn');\n button.addEventListener('click', () => value());\n this.headerElement.appendChild(button);\n })\n }\n getElement () {\n return this.viewElement.element;\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/Location.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | /*! 11 | * XAtom Debug 12 | * Copyright(c) 2017 Williams Medina 13 | * MIT Licensed 14 | */ 15 | const { CompositeDisposable, Range, Emitter, Disposable } = require('atom'); 16 | import { get } from 'lodash'; 17 | export class Location { 18 | constructor(location, type) { 19 | this.location = location; 20 | this.openEditor(location); 21 | this.setClassName(type); 22 | } 23 | setClassName(type) { 24 | let typeClass = ''; 25 | if (type) { 26 | typeClass = `xatom-debug-location-${type}`; 27 | } 28 | this.className = `xatom-debug-location ${typeClass}`; 29 | } 30 | markLocation(location) { 31 | return __awaiter(this, void 0, void 0, function* () { 32 | if (this.lineDecorator) 33 | this.lineDecorator.destroy(); 34 | if (this.lineNumberDecorator) 35 | this.lineNumberDecorator.destroy(); 36 | if (this.lineMarker) 37 | this.lineMarker.destroy(); 38 | if (this.lineNumberMarker) 39 | this.lineNumberMarker.destroy(); 40 | const range = new Range([location.lineNumber, location.columnNumber], [location.lineNumber, location.columnNumber]); 41 | this.lineMarker = this.editor.markBufferRange(range); 42 | this.lineNumberMarker = this.editor.markBufferRange(range); 43 | this.lineDecorator = this.editor.decorateMarker(this.lineMarker, { 44 | type: 'line', 45 | class: this.className 46 | }); 47 | this.lineNumberDecorator = this.editor.decorateMarker(this.lineNumberMarker, { 48 | type: 'line-number', 49 | class: this.className 50 | }); 51 | atom.focus(); 52 | }); 53 | } 54 | updateDecorators() { 55 | this.lineDecorator.setProperties({ 56 | type: 'line', 57 | class: this.className 58 | }); 59 | this.lineNumberDecorator.setProperties({ 60 | type: 'line-number', 61 | class: this.className 62 | }); 63 | } 64 | openEditor(location) { 65 | return __awaiter(this, void 0, void 0, function* () { 66 | const lineRange = new Range([location.lineNumber, 0], [location.lineNumber, 0]); 67 | this.editor = (yield atom.workspace.open(location.filePath, { 68 | initialLine: location.lineNumber || 0, 69 | initialColumn: location.columnNumber || 0 70 | })); 71 | this.editor 72 | .getGutters() 73 | .filter((gutter) => gutter.name !== 'line-number') 74 | .forEach((gutter) => { 75 | gutter.hide(); 76 | }); 77 | const decorator = this.editor 78 | .getLineNumberDecorations({ 79 | class: 'xatom-breakpoint' 80 | }) 81 | .find((d) => { 82 | return lineRange.isEqual(d.getMarker().getBufferRange()); 83 | }); 84 | if (decorator) { 85 | this.setClassName('breakpoint'); 86 | } 87 | this.markLocation(location); 88 | this.editor.onDidAddDecoration((decoration) => { 89 | const className = get(decoration, 'properties.class'); 90 | const isBreakpoint = className === 'xatom-breakpoint'; 91 | if (isBreakpoint && lineRange.isEqual(decoration.getMarker().getBufferRange())) { 92 | this.setClassName('breakpoint'); 93 | this.updateDecorators(); 94 | } 95 | }); 96 | }); 97 | } 98 | destroy() { 99 | if (this.editor) { 100 | this 101 | .editor 102 | .getGutters() 103 | .filter((gutter) => gutter.name !== 'line-number') 104 | .forEach((gutter) => gutter.show()); 105 | } 106 | if (this.lineDecorator) 107 | this.lineDecorator.destroy(); 108 | if (this.lineNumberDecorator) 109 | this.lineNumberDecorator.destroy(); 110 | if (this.lineMarker) 111 | this.lineMarker.destroy(); 112 | if (this.lineNumberMarker) 113 | this.lineNumberMarker.destroy(); 114 | } 115 | } 116 | //# sourceMappingURL=Location.js.map -------------------------------------------------------------------------------- /lib/Package.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | export class XAtomDebugPackage { 8 | activate() { 9 | const { XAtomDebug } = require('./XAtomDebug'); 10 | this.xAtomDebug = new XAtomDebug(); 11 | } 12 | deactivate() { 13 | if (this.xAtomDebug) { 14 | this.xAtomDebug.destroy(); 15 | } 16 | } 17 | providePlugin() { 18 | return this.xAtomDebug.getProvider(); 19 | } 20 | deserializeBreakpointNavigatorView(serialized) { 21 | const { BreakpointNavigatorView } = require('./Breakpoint'); 22 | return new BreakpointNavigatorView(null); 23 | } 24 | } 25 | module.exports = new XAtomDebugPackage(); 26 | //# sourceMappingURL=Package.js.map -------------------------------------------------------------------------------- /lib/Package.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Package.js","sourceRoot":"","sources":["../src2/Package.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,MAAM;IAEJ,QAAQ;QACN,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IACrC,CAAC;IACD,UAAU;QACR,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,aAAa;QACX,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;IACD,kCAAkC,CAAE,UAAU;QAC5C,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AACD,MAAM,CAAC,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport class XAtomDebugPackage {\n private xAtomDebug: any;\n activate (): void {\n const { XAtomDebug } = require('./XAtomDebug');\n this.xAtomDebug = new XAtomDebug();\n }\n deactivate (): void {\n if (this.xAtomDebug) {\n this.xAtomDebug.destroy();\n }\n }\n providePlugin () {\n return this.xAtomDebug.getProvider();\n }\n deserializeBreakpointNavigatorView (serialized) {\n const { BreakpointNavigatorView } = require('./Breakpoint');\n return new BreakpointNavigatorView(null);\n }\n}\nmodule.exports = new XAtomDebugPackage();\n"]} -------------------------------------------------------------------------------- /lib/Project.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | const { Emitter } = require('atom'); 8 | export class ProjectManager { 9 | constructor() { 10 | this.emitter = new Emitter(); 11 | } 12 | setActive(project) { 13 | this.project = project; 14 | this.emitter.emit('didChange', project); 15 | } 16 | onDidChange(cb) { 17 | return this.emitter.on('didChange', cb); 18 | } 19 | getActive() { 20 | return this.project; 21 | } 22 | } 23 | //# sourceMappingURL=Project.js.map -------------------------------------------------------------------------------- /lib/Project.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Project.js","sourceRoot":"","sources":["../src2/Project.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAOpC,MAAM;IAGJ;QADQ,YAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAGhC,CAAC;IACD,SAAS,CAAE,OAAgB;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,WAAW,CAAE,EAAE;QACb,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,SAAS;QACP,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nconst { Emitter } = require('atom');\nimport { Item } from './Storage';\n\nexport interface Project extends Item {\n projectPath: string\n}\n\nexport class ProjectManager {\n private project: Project;\n private emitter = new Emitter();\n constructor () {\n\n }\n setActive (project: Project) {\n this.project = project;\n this.emitter.emit('didChange', project);\n }\n onDidChange (cb) {\n return this.emitter.on('didChange', cb);\n }\n getActive () {\n return this.project;\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/SchemeEditorView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | /*! 12 | * XAtom Debug 13 | * Copyright(c) 2017 Williams Medina 14 | * MIT Licensed 15 | */ 16 | import { View, ViewElement } from './View'; 17 | export const SCHEME_EDITOR_URI = 'xatom://scheme-editor'; 18 | let SchemeEditorView = class SchemeEditorView { 19 | constructor(viewElement) { 20 | this.viewElement = viewElement; 21 | } 22 | setPlugins(plugins) { 23 | console.log('add plugins', plugins); 24 | } 25 | getElement() { 26 | return this.viewElement.element; 27 | } 28 | getTitle() { 29 | return 'Scheme Editor'; 30 | } 31 | getURI() { 32 | return SCHEME_EDITOR_URI; 33 | } 34 | getPreferredLocation() { 35 | return 'center'; 36 | } 37 | getAllowedLocations() { 38 | return ['center']; 39 | } 40 | destroy() { 41 | atom.workspace.hide(SCHEME_EDITOR_URI); 42 | this.viewElement.element.remove(); 43 | } 44 | }; 45 | SchemeEditorView = __decorate([ 46 | View({ 47 | name: 'xatom-scheme-editor', 48 | template: `

Scheme Editor

` 49 | }), 50 | __metadata("design:paramtypes", [ViewElement]) 51 | ], SchemeEditorView); 52 | export { SchemeEditorView }; 53 | //# sourceMappingURL=SchemeEditorView.js.map -------------------------------------------------------------------------------- /lib/SchemeEditorView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SchemeEditorView.js","sourceRoot":"","sources":["../src2/SchemeEditorView.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;;;;;;;;;;AACZ;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAMzD,IAAa,gBAAgB,GAA7B;IACE,YAAqB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAI,CAAC;IAClD,UAAU,CAAE,OAAc;QACxB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,UAAU;QACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IAClC,CAAC;IACD,QAAQ;QACN,MAAM,CAAC,eAAe,CAAC;IACzB,CAAC;IACD,MAAM;QACJ,MAAM,CAAC,iBAAiB,CAAC;IAC3B,CAAC;IACD,oBAAoB;QAClB,MAAM,CAAC,QAAQ,CAAC;IAClB,CAAC;IACD,mBAAmB;QACjB,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,gBAAgB;IAJ5B,IAAI,CAAC;QACJ,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,wBAAwB;KACnC,CAAC;qCAEkC,WAAW;GADlC,gBAAgB,CAwB5B;SAxBY,gBAAgB","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { View, ViewElement } from './View';\n\nexport const SCHEME_EDITOR_URI = 'xatom://scheme-editor';\n\n@View({\n name: 'xatom-scheme-editor',\n template: `

Scheme Editor

`\n})\nexport class SchemeEditorView {\n constructor (private viewElement: ViewElement) { }\n setPlugins (plugins: any[]) {\n console.log('add plugins', plugins);\n }\n getElement () {\n return this.viewElement.element;\n }\n getTitle () {\n return 'Scheme Editor';\n }\n getURI () {\n return SCHEME_EDITOR_URI;\n }\n getPreferredLocation () {\n return 'center';\n }\n getAllowedLocations () {\n return ['center'];\n }\n destroy () {\n atom.workspace.hide(SCHEME_EDITOR_URI);\n this.viewElement.element.remove();\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/View.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | import 'reflect-metadata'; 11 | // const viewControllerRegistry = new EventEmitter(); 12 | const viewRegistry = []; 13 | // viewControllerRegistry.setMaxListeners(0); 14 | // 15 | // 16 | // function getViewController (target: any): Promise<{ 17 | // viewController: ViewController, 18 | // complete: Function 19 | // }> { 20 | // return new Promise ((resolve, reject) => { 21 | // viewControllerRegistry.on('viewControllerLoad', function eventListener (controller: ViewController) { 22 | // if (Object.getPrototypeOf(controller.controller) === target) { 23 | // const task = new Promise((taskResolve, taskReject) => { 24 | // resolve({ 25 | // viewController: controller, 26 | // complete: taskResolve 27 | // }); 28 | // }); 29 | // console.log('register'); 30 | // controller.tasks.push(task); 31 | // viewControllerRegistry.removeListener('viewControllerLoad', eventListener); 32 | // } 33 | // }) 34 | // }) 35 | // } 36 | function getHTMLElement(controller, query) { 37 | return new Promise((resolve, reject) => { 38 | const el = controller.viewElement.element.querySelector(query); 39 | if (el) { 40 | resolve(el); 41 | } 42 | else { 43 | reject(`element '${query}' does not exists`); 44 | } 45 | }); 46 | } 47 | export function Action(eventName, query) { 48 | return function (target, key, descriptor) { 49 | viewRegistry.push({ 50 | target, 51 | create(viewController, instance) { 52 | return __awaiter(this, void 0, void 0, function* () { 53 | const el = yield getHTMLElement(viewController, query); 54 | el.addEventListener(eventName, (event) => { 55 | if (instance[key]) { 56 | instance[key](event); 57 | } 58 | }); 59 | }); 60 | } 61 | }); 62 | return descriptor; 63 | }; 64 | } 65 | export function Element(query) { 66 | return function (target, key, descriptor) { 67 | viewRegistry.push({ 68 | target, 69 | create(viewController, instance) { 70 | return __awaiter(this, void 0, void 0, function* () { 71 | const el = yield getHTMLElement(viewController, query); 72 | instance[key] = el; 73 | }); 74 | } 75 | }); 76 | return descriptor; 77 | }; 78 | } 79 | export class ViewElement { 80 | constructor(elementName, template) { 81 | this.element = document.createElement(elementName); 82 | this.element.innerHTML = template || ''; 83 | } 84 | } 85 | export class ViewController { 86 | constructor(viewElement) { 87 | this.viewElement = viewElement; 88 | // do something 89 | } 90 | } 91 | export function View(options) { 92 | return function createView(target, key, descriptor) { 93 | const instance = function () { 94 | const paramTypes = Reflect.getMetadata('design:paramtypes', target, key); 95 | const viewElement = new ViewElement(options.name, options.template); 96 | const viewController = new ViewController(viewElement); 97 | const paramValues = paramTypes.map((param, index) => { 98 | if (param === ViewElement) 99 | return viewElement; 100 | if (param === ViewController) 101 | return viewController; 102 | return arguments[index]; 103 | }); 104 | target.apply(this, paramValues); 105 | const load = viewRegistry 106 | .filter(({ target }) => { 107 | return Object.getPrototypeOf(this) === target; 108 | }) 109 | .map(({ create }) => { 110 | return create(viewController, this); 111 | }) 112 | .reduce((r, p) => p.then(r), Promise.resolve()) 113 | .then(() => { 114 | if (this.viewDidLoad) { 115 | this.viewDidLoad(); 116 | } 117 | }); 118 | }; 119 | instance.prototype = target.prototype; 120 | return instance; 121 | }; 122 | } 123 | //# sourceMappingURL=View.js.map -------------------------------------------------------------------------------- /lib/XAtom.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { BreakpointManager } from './breakpoint'; 8 | import { ProjectManager } from './Project'; 9 | export var XAtom; 10 | (function (XAtom) { 11 | XAtom.breakpoints = new BreakpointManager(); 12 | XAtom.project = new ProjectManager(); 13 | })(XAtom || (XAtom = {})); 14 | //# sourceMappingURL=XAtom.js.map -------------------------------------------------------------------------------- /lib/XAtom.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"XAtom.js","sourceRoot":"","sources":["../src2/XAtom.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,KAAW,KAAK,CAGrB;AAHD,WAAiB,KAAK;IACP,iBAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;IACtC,aAAO,GAAG,IAAI,cAAc,EAAE,CAAC;AAC9C,CAAC,EAHgB,KAAK,KAAL,KAAK,QAGrB","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { BreakpointManager } from './breakpoint';\nimport { ProjectManager } from './Project';\n\nexport namespace XAtom {\n export const breakpoints = new BreakpointManager();\n export const project = new ProjectManager();\n}\n"]} -------------------------------------------------------------------------------- /lib/breakpoint/Breakpoint.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | //# sourceMappingURL=Breakpoint.js.map -------------------------------------------------------------------------------- /lib/breakpoint/Breakpoint.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Breakpoint.js","sourceRoot":"","sources":["../../src2/breakpoint/Breakpoint.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { Item } from '../storage';\n\nexport interface Breakpoint extends Item {\n lineNumber: number,\n columnNumber: number,\n filePath: string,\n condition: string,\n marker?: any\n}\nexport type Breakpoints = Array;\n"]} -------------------------------------------------------------------------------- /lib/breakpoint/BreakpointNavigatorView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 12 | return new (P || (P = Promise))(function (resolve, reject) { 13 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 14 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 15 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 16 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 17 | }); 18 | }; 19 | /*! 20 | * XAtom Debug 21 | * Copyright(c) 2017 Williams Medina 22 | * MIT Licensed 23 | */ 24 | const { CompositeDisposable, Disposable } = require('atom'); 25 | import { XAtom } from '../XAtom'; 26 | import { View, ViewElement } from '../View'; 27 | import { GroupView } from '../GroupView'; 28 | import { BreakpointView } from './BreakpointView'; 29 | export const BREAKPOINT_NAVIGATOR_URI = 'xatom://breakpoint-navigator'; 30 | let BreakpointNavigatorView = class BreakpointNavigatorView { 31 | constructor(viewElement) { 32 | this.viewElement = viewElement; 33 | this.breakpointGroupView = new GroupView(null, { 34 | title: ' ', 35 | actions: { 36 | 'Remove All': () => this.removeAll() 37 | } 38 | }); 39 | this.element = this.getElement(); 40 | this.element.appendChild(this.breakpointGroupView.getElement()); 41 | this.setCurrentBreakpoints(); 42 | this.subscriptions = new CompositeDisposable(XAtom.project.onDidChange(() => this.setCurrentBreakpoints()), XAtom.breakpoints.onDidAdd((b) => this.addBreakpoint(b)), XAtom.breakpoints.onDidRemove((b) => this.removeBreakpoint(b))); 43 | } 44 | addBreakpoint(breakpoint) { 45 | const item = new BreakpointView(null, breakpoint); 46 | this.breakpointGroupView.addItem(item.getElement(), { 47 | filePath: breakpoint.filePath, 48 | lineNumber: breakpoint.lineNumber 49 | }); 50 | } 51 | removeBreakpoint(breakpoint) { 52 | this.breakpointGroupView.removeItem({ 53 | filePath: breakpoint.filePath, 54 | lineNumber: breakpoint.lineNumber 55 | }); 56 | } 57 | removeAll() { 58 | return __awaiter(this, void 0, void 0, function* () { 59 | const breakpoints = yield XAtom.breakpoints.get(); 60 | breakpoints.forEach((b) => XAtom.breakpoints.remove(b.filePath, b.lineNumber)); 61 | }); 62 | } 63 | setCurrentBreakpoints() { 64 | return __awaiter(this, void 0, void 0, function* () { 65 | this.breakpointGroupView.removeItems(); 66 | const breakpoints = yield XAtom.breakpoints.get(); 67 | breakpoints.forEach((b) => this.addBreakpoint(b)); 68 | }); 69 | } 70 | getElement() { 71 | return this.viewElement.element; 72 | } 73 | getTitle() { 74 | return 'Breakpoints'; 75 | } 76 | getURI() { 77 | return BREAKPOINT_NAVIGATOR_URI; 78 | } 79 | serialize() { 80 | return { 81 | deserializer: 'XAtom/BreakpointNavigatorView' 82 | }; 83 | } 84 | getDefaultLocation() { 85 | return 'right'; 86 | } 87 | getAllowedLocations() { 88 | return ['right', 'center', 'left']; 89 | } 90 | destroy() { 91 | atom.workspace.hide(BREAKPOINT_NAVIGATOR_URI); 92 | this.viewElement.element.remove(); 93 | this.subscriptions.dispose(); 94 | } 95 | }; 96 | BreakpointNavigatorView = __decorate([ 97 | View({ 98 | name: 'xatom-breakpoint-navigator' 99 | }), 100 | __metadata("design:paramtypes", [ViewElement]) 101 | ], BreakpointNavigatorView); 102 | export { BreakpointNavigatorView }; 103 | //# sourceMappingURL=BreakpointNavigatorView.js.map -------------------------------------------------------------------------------- /lib/breakpoint/BreakpointNavigatorView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"BreakpointNavigatorView.js","sourceRoot":"","sources":["../../src2/breakpoint/BreakpointNavigatorView.ts"],"names":[],"mappings":"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","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nconst { CompositeDisposable, Disposable } = require('atom');\nimport { XAtom } from '../XAtom';\nimport { View, ViewElement } from '../View';\nimport { Project } from '../Project';\nimport { GroupView } from '../GroupView';\nimport { Breakpoint } from './Breakpoint';\nimport { BreakpointView } from './BreakpointView';\n\nexport const BREAKPOINT_NAVIGATOR_URI = 'xatom://breakpoint-navigator';\n\n@View({\n name: 'xatom-breakpoint-navigator'\n})\nexport class BreakpointNavigatorView {\n public element: HTMLElement;\n private subscriptions: any;\n private breakpointGroupView: GroupView;\n constructor (private viewElement: ViewElement) {\n this.breakpointGroupView = new GroupView(null, {\n title: ' ',\n actions: {\n 'Remove All': () => this.removeAll()\n }\n });\n this.element = this.getElement();\n this.element.appendChild(this.breakpointGroupView.getElement());\n this.setCurrentBreakpoints();\n this.subscriptions = new CompositeDisposable(\n XAtom.project.onDidChange(() => this.setCurrentBreakpoints()),\n XAtom.breakpoints.onDidAdd((b: Breakpoint) => this.addBreakpoint(b)),\n XAtom.breakpoints.onDidRemove((b: Breakpoint) => this.removeBreakpoint(b))\n );\n }\n addBreakpoint (breakpoint: Breakpoint) {\n const item = new BreakpointView(null, breakpoint);\n this.breakpointGroupView.addItem(item.getElement(), {\n filePath: breakpoint.filePath,\n lineNumber: breakpoint.lineNumber\n });\n }\n removeBreakpoint (breakpoint: Breakpoint) {\n this.breakpointGroupView.removeItem({\n filePath: breakpoint.filePath,\n lineNumber: breakpoint.lineNumber\n });\n }\n async removeAll () {\n const breakpoints = await XAtom.breakpoints.get();\n breakpoints.forEach((b) => XAtom.breakpoints.remove(b.filePath, b.lineNumber));\n }\n async setCurrentBreakpoints () {\n this.breakpointGroupView.removeItems();\n const breakpoints = await XAtom.breakpoints.get();\n breakpoints.forEach((b) => this.addBreakpoint(b));\n }\n getElement () {\n return this.viewElement.element;\n }\n getTitle () {\n return 'Breakpoints';\n }\n getURI () {\n return BREAKPOINT_NAVIGATOR_URI;\n }\n serialize() {\n return {\n deserializer: 'XAtom/BreakpointNavigatorView'\n };\n }\n getDefaultLocation () {\n return 'right';\n }\n getAllowedLocations () {\n return ['right', 'center', 'left'];\n }\n destroy () {\n atom.workspace.hide(BREAKPOINT_NAVIGATOR_URI);\n this.viewElement.element.remove();\n this.subscriptions.dispose();\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/breakpoint/BreakpointView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | /*! 12 | * XAtom Debug 13 | * Copyright(c) 2017 Williams Medina 14 | * MIT Licensed 15 | */ 16 | import { XAtom } from '../XAtom'; 17 | import { View, ViewElement, Action, Element } from '../View'; 18 | import { join } from 'path'; 19 | let BreakpointView = class BreakpointView { 20 | constructor(viewElement, data) { 21 | this.viewElement = viewElement; 22 | this.data = data; 23 | this.element = this.getElement(); 24 | } 25 | openBreakpoint() { 26 | atom.workspace.open(this.data.filePath, { 27 | initialLine: this.data.lineNumber || 0, 28 | initialColumn: this.data.columnNumber || 0 29 | }); 30 | } 31 | viewDidLoad() { 32 | const project = XAtom.project.getActive(); 33 | const filePath = this.data.filePath.replace(join(project.projectPath, '/'), ''); 34 | this.itemElement.innerHTML = `${filePath} 35 | ${this.data.lineNumber + 1}:${this.data.columnNumber}`; 36 | this.itemElement.setAttribute('data-name', this.data.filePath); 37 | } 38 | getElement() { 39 | return this.viewElement.element; 40 | } 41 | }; 42 | __decorate([ 43 | Element('.xatom-debug-breakpoint'), 44 | __metadata("design:type", HTMLButtonElement) 45 | ], BreakpointView.prototype, "itemElement", void 0); 46 | __decorate([ 47 | Action('click', '.xatom-debug-breakpoint'), 48 | __metadata("design:type", Function), 49 | __metadata("design:paramtypes", []), 50 | __metadata("design:returntype", void 0) 51 | ], BreakpointView.prototype, "openBreakpoint", null); 52 | BreakpointView = __decorate([ 53 | View({ 54 | name: 'xatom-debug-breakpoint', 55 | template: `
56 |
57 | 58 |
59 |
` 60 | }), 61 | __metadata("design:paramtypes", [ViewElement, Object]) 62 | ], BreakpointView); 63 | export { BreakpointView }; 64 | //# sourceMappingURL=BreakpointView.js.map -------------------------------------------------------------------------------- /lib/breakpoint/BreakpointView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"BreakpointView.js","sourceRoot":"","sources":["../../src2/breakpoint/BreakpointView.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;;;;;;;;;;AACZ;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAU5B,IAAa,cAAc,GAA3B;IASE,YACU,WAAwB,EACxB,IAAgB;QADhB,gBAAW,GAAX,WAAW,CAAa;QACxB,SAAI,GAAJ,IAAI,CAAY;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAV2C,cAAc;QACxD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACtC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC;YACtC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC;SAC3C,CAAC,CAAC;IACL,CAAC;IAMD,WAAW;QACT,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,WAAW,CAAC,SAAS,GAAG,GAAG,QAAQ;QACpC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;IACD,UAAU;QACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IAClC,CAAC;CACF,CAAA;AAtBqC;IAAnC,OAAO,CAAC,yBAAyB,CAAC;8BAAc,iBAAiB;mDAAC;AACvB;IAA3C,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC;;;;oDAK1C;AARU,cAAc;IAR1B,IAAI,CAAC;QACJ,IAAI,EAAE,wBAAwB;QAC9B,QAAQ,EAAE;;;;SAIH;KACR,CAAC;qCAWuB,WAAW;GAVvB,cAAc,CAwB1B;SAxBY,cAAc","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { XAtom } from '../XAtom';\nimport { View, ViewElement, Action, Element } from '../View';\nimport { Breakpoint } from './Breakpoint';\nimport { stat } from 'fs';\nimport { join } from 'path';\n\n@View({\n name: 'xatom-debug-breakpoint',\n template: `
\n
\n \n
\n
`\n})\nexport class BreakpointView {\n public element: HTMLElement;\n @Element('.xatom-debug-breakpoint') itemElement: HTMLButtonElement;\n @Action('click', '.xatom-debug-breakpoint') openBreakpoint () {\n atom.workspace.open(this.data.filePath, {\n initialLine: this.data.lineNumber || 0,\n initialColumn: this.data.columnNumber || 0\n });\n }\n constructor (\n private viewElement: ViewElement,\n private data: Breakpoint) {\n this.element = this.getElement();\n }\n viewDidLoad () {\n const project = XAtom.project.getActive();\n const filePath = this.data.filePath.replace(join(project.projectPath, '/'), '');\n this.itemElement.innerHTML = `${filePath}\n ${this.data.lineNumber + 1}:${this.data.columnNumber}`;\n this.itemElement.setAttribute('data-name', this.data.filePath);\n }\n getElement () {\n return this.viewElement.element;\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/breakpoint/index.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | export * from './BreakpointManager'; 3 | export * from './BreakpointNavigatorView'; 4 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/breakpoint/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src2/breakpoint/index.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AAQZ,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport * from './Breakpoint';\nexport * from './BreakpointManager';\nexport * from './BreakpointNavigatorView';\n"]} -------------------------------------------------------------------------------- /lib/debug/CallFrame.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | //# sourceMappingURL=CallFrame.js.map -------------------------------------------------------------------------------- /lib/debug/CallFrame.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CallFrame.js","sourceRoot":"","sources":["../../src2/debug/CallFrame.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport interface CallFrame {\n filePath: string;\n functionName: string;\n lineNumber: number;\n columnNumber: number;\n}\n\nexport type CallFrames = Array;\n"]} -------------------------------------------------------------------------------- /lib/debug/DebugAreaView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | /*! 12 | * XAtom Debug 13 | * Copyright(c) 2017 Williams Medina 14 | * MIT Licensed 15 | */ 16 | const { CompositeDisposable, Emitter, Disposable } = require('atom'); 17 | import { View, ViewElement } from '../View'; 18 | import ResizeObserver from 'resize-observer-polyfill'; 19 | import { spawn as spawnPty } from 'node-pty'; 20 | import Terminal from 'xterm'; 21 | const path = require('path'); 22 | Terminal.loadAddon('fit'); 23 | export const DEBUG_AREA_URI = 'xatom://debug-area'; 24 | let DebugAreaView = class DebugAreaView { 25 | constructor(viewElement) { 26 | this.viewElement = viewElement; 27 | this.emitter = new Emitter(); 28 | this.element = this.getElement(); 29 | } 30 | elementDidResize() { 31 | clearTimeout(this.resizeHandler); 32 | this.resizeHandler = setTimeout(() => { 33 | if (this.terminal) { 34 | this.terminal.fit(); 35 | if (this.pty) 36 | this.pty.resize(this.terminal.cols, this.terminal.rows); 37 | } 38 | ; 39 | }, 250); 40 | } 41 | onDidExitProcess(cb) { 42 | return this.emitter.on('didExitProccess', cb); 43 | } 44 | showInitialMessage() { 45 | const date = new Date().toString(); 46 | this.terminal.writeln(`\x1b[1m\x1b[90mXAtom: Debugger v1.6.11\x1b[0m\x1b[0m`); 47 | this.terminal.writeln(`\x1b[1m\x1b[90m${date}\x1b[0m\x1b[0m`); 48 | } 49 | startProcess(command, args, options) { 50 | const projectPaths = atom.project.getPaths(); 51 | const defaultOptions = { 52 | name: 'xterm-color', 53 | cwd: path.resolve(process.env.HOME), 54 | env: Object.assign({}, process.env, { 55 | TERM: 'xterm-256color', 56 | CLICOLOR: '1', 57 | LSCOLORS: 'ExFxCxDxBxegedabagacad' 58 | }) 59 | }; 60 | this.pty = spawnPty(command, args || [], Object.assign(defaultOptions, options)); 61 | this.terminal = new Terminal(); 62 | this.terminal.open(this.getElement(), true); 63 | this.terminal.on('data', (data) => { 64 | return this.pty.write(data); 65 | }); 66 | this.showInitialMessage(); 67 | this.element.addEventListener('focus', () => this.terminal.focus()); 68 | this.resizeObserver = new ResizeObserver(this.elementDidResize.bind(this)); 69 | this.resizeObserver.observe(this.element); 70 | this.pty.on('data', (data) => { 71 | return this.terminal.write(data); 72 | }); 73 | this.pty.on('exit', () => { 74 | this.emitter.emit('didExitProccess'); 75 | this.destroy(); 76 | }); 77 | return this.pty; 78 | } 79 | destroy() { 80 | if (this.resizeObserver) 81 | this.resizeObserver.disconnect(); 82 | if (this.pty) 83 | this.pty.kill(); 84 | if (this.terminal) 85 | this.terminal.destroy(); 86 | this.pty = null; 87 | } 88 | clear() { 89 | this.terminal.clear(); 90 | } 91 | copySelection() { 92 | let selectedText = window.getSelection().toString(); 93 | let preparedText = this.formatText(selectedText); 94 | atom.clipboard.write(preparedText); 95 | } 96 | pasteFromClipboard() { 97 | let text = atom.clipboard.read(); 98 | this.pty.write(text); 99 | } 100 | formatText(text) { 101 | const space = String.fromCharCode(32); 102 | const nonBreakingSpace = String.fromCharCode(160); 103 | const allNonBreakingSpaces = new RegExp(nonBreakingSpace, 'g'); 104 | return text.split('\n').map((line) => { 105 | return line.replace(/\s+$/g, '').replace(allNonBreakingSpaces, space); 106 | }).join('\n'); 107 | } 108 | getDefaultLocation() { 109 | return 'bottom'; 110 | } 111 | getAllowedLocations() { 112 | return ['bottom', 'top', 'center']; 113 | } 114 | getElement() { 115 | return this.viewElement.element; 116 | } 117 | getURI() { 118 | return DEBUG_AREA_URI; 119 | } 120 | getIconName() { 121 | return 'debug-area'; 122 | } 123 | getTitle() { 124 | return 'Debug Area'; 125 | } 126 | }; 127 | DebugAreaView = __decorate([ 128 | View({ 129 | name: 'xatom-debug-area' 130 | }), 131 | __metadata("design:paramtypes", [ViewElement]) 132 | ], DebugAreaView); 133 | export { DebugAreaView }; 134 | //# sourceMappingURL=DebugAreaView.js.map -------------------------------------------------------------------------------- /lib/debug/DebugFrameView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 12 | return new (P || (P = Promise))(function (resolve, reject) { 13 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 14 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 15 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 16 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 17 | }); 18 | }; 19 | /*! 20 | * XAtom Debug 21 | * Copyright(c) 2017 Williams Medina 22 | * MIT Licensed 23 | */ 24 | import { XAtom } from '../XAtom'; 25 | import { View, ViewElement, Action, Element } from '../View'; 26 | import { join } from 'path'; 27 | let DebugFrameView = class DebugFrameView { 28 | constructor(viewElement, data) { 29 | this.viewElement = viewElement; 30 | this.data = data; 31 | this.element = this.getElement(); 32 | } 33 | openFrame() { 34 | // open file 35 | atom.workspace.open(this.data.filePath, { 36 | initialLine: this.data.lineNumber || 0, 37 | initialColumn: this.data.columnNumber || 0 38 | }); 39 | } 40 | viewDidLoad() { 41 | return __awaiter(this, void 0, void 0, function* () { 42 | // if (this.data) { 43 | // const fileExists = await new Promise((resolve) => { 44 | // stat(this.data.filePath, (err) => resolve(err ? false : true)); 45 | // }); 46 | // if (fileExists) { 47 | // // test 48 | // } 49 | // } 50 | const project = XAtom.project.getActive(); 51 | const filePath = this.data.filePath.replace(join(project.projectPath, '/'), ''); 52 | this.itemElement.innerHTML = ` 53 |
54 | ${this.data.functionName || 'anonymous'} 55 |
56 |
57 |
${filePath}
58 |
${this.data.lineNumber + 1}:${this.data.columnNumber}
59 |
`; 60 | // this.itemElement.setAttribute('data-name', filePath); 61 | }); 62 | } 63 | getElement() { 64 | return this.viewElement.element; 65 | } 66 | }; 67 | __decorate([ 68 | Element('.xatom-group-item'), 69 | __metadata("design:type", HTMLButtonElement) 70 | ], DebugFrameView.prototype, "itemElement", void 0); 71 | __decorate([ 72 | Action('click', '.xatom-group-item'), 73 | __metadata("design:type", Function), 74 | __metadata("design:paramtypes", []), 75 | __metadata("design:returntype", void 0) 76 | ], DebugFrameView.prototype, "openFrame", null); 77 | DebugFrameView = __decorate([ 78 | View({ 79 | name: 'xatom-debug-frame', 80 | template: `
` 81 | }), 82 | __metadata("design:paramtypes", [ViewElement, Object]) 83 | ], DebugFrameView); 84 | export { DebugFrameView }; 85 | //# sourceMappingURL=DebugFrameView.js.map -------------------------------------------------------------------------------- /lib/debug/DebugFrameView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DebugFrameView.js","sourceRoot":"","sources":["../../src2/debug/DebugFrameView.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;;;;;;;;;;;;;;;;;;AACZ;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAM5B,IAAa,cAAc,GAA3B;IAUE,YACU,WAAwB,EACxB,IAAe;QADf,gBAAW,GAAX,WAAW,CAAa;QACxB,SAAI,GAAJ,IAAI,CAAW;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAXqC,SAAS;QAC7C,YAAY;QACZ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACtC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC;YACtC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC;SAC3C,CAAC,CAAC;IACL,CAAC;IAMK,WAAW;;YACf,mBAAmB;YACnB,iEAAiE;YACjE,sEAAsE;YACtE,QAAQ;YACR,sBAAsB;YACtB,cAAc;YACd,MAAM;YACN,IAAI;YACJ,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YAEhF,IAAI,CAAC,WAAW,CAAC,SAAS,GAAG;;UAEvB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,WAAW;;;8CAGD,QAAQ;kDACJ,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY;aACvF,CAAC;YACV,wDAAwD;QAC1D,CAAC;KAAA;IACD,UAAU;QACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IAClC,CAAC;CACF,CAAA;AAtC+B;IAA7B,OAAO,CAAC,mBAAmB,CAAC;8BAAc,iBAAiB;mDAAC;AACvB;IAArC,MAAM,CAAC,OAAO,EAAE,mBAAmB,CAAC;;;;+CAMpC;AATU,cAAc;IAJ1B,IAAI,CAAC;QACJ,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,sCAAsC;KACjD,CAAC;qCAYuB,WAAW;GAXvB,cAAc,CAwC1B;SAxCY,cAAc","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { XAtom } from '../XAtom';\nimport { View, ViewElement, Action, Element } from '../View';\nimport { CallFrame } from './CallFrame';\nimport { stat } from 'fs';\nimport { join } from 'path';\n\n@View({\n name: 'xatom-debug-frame',\n template: `
`\n})\nexport class DebugFrameView {\n public element: HTMLElement;\n @Element('.xatom-group-item') itemElement: HTMLButtonElement;\n @Action('click', '.xatom-group-item') openFrame () {\n // open file\n atom.workspace.open(this.data.filePath, {\n initialLine: this.data.lineNumber || 0,\n initialColumn: this.data.columnNumber || 0\n });\n }\n constructor (\n private viewElement: ViewElement,\n private data: CallFrame) {\n this.element = this.getElement();\n }\n async viewDidLoad () {\n // if (this.data) {\n // const fileExists = await new Promise((resolve) => {\n // stat(this.data.filePath, (err) => resolve(err ? false : true));\n // });\n // if (fileExists) {\n // // test\n // }\n // }\n const project = XAtom.project.getActive();\n const filePath = this.data.filePath.replace(join(project.projectPath, '/'), '');\n\n this.itemElement.innerHTML = `\n
\n ${this.data.functionName || 'anonymous'}\n
\n
\n
${filePath}
\n
${this.data.lineNumber + 1}:${this.data.columnNumber}
\n
`;\n // this.itemElement.setAttribute('data-name', filePath);\n }\n getElement () {\n return this.viewElement.element;\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/debug/DebugNavigatorView.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | /*! 12 | * XAtom Debug 13 | * Copyright(c) 2017 Williams Medina 14 | * MIT Licensed 15 | */ 16 | import { View, ViewElement } from '../View'; 17 | import { GroupView } from '../GroupView'; 18 | import { DebugFrameView } from './DebugFrameView'; 19 | export const DEBUG_NAVIGATOR_URI = 'xatom://debug-navigator'; 20 | let DebugNavigatorView = class DebugNavigatorView { 21 | constructor(viewElement) { 22 | this.viewElement = viewElement; 23 | this.element = this.getElement(); 24 | // Variables 25 | this.variableGroupView = new GroupView(null, { 26 | title: 'Variables' 27 | }); 28 | this.element.appendChild(this.variableGroupView.getElement()); 29 | // Watch 30 | this.watchGroupView = new GroupView(null, { 31 | title: 'Watch' 32 | }); 33 | this.element.appendChild(this.watchGroupView.getElement()); 34 | // Call Frames 35 | this.frameGroupView = new GroupView(null, { 36 | title: 'Call Frames', 37 | selectable: true 38 | }); 39 | this.element.appendChild(this.frameGroupView.getElement()); 40 | } 41 | // Variables 42 | addVariable(variable) { 43 | } 44 | setVariables(variables) { 45 | this.clearVariables(); 46 | variables.forEach((variable) => this.addVariable(variable)); 47 | } 48 | clearVariables() { 49 | this.variableGroupView.removeItems(); 50 | } 51 | // Watch 52 | addWatchVariable(expression) { 53 | // 54 | } 55 | // Frames 56 | addFrame(frame) { 57 | const item = new DebugFrameView(null, frame); 58 | return this.frameGroupView.addItem(item.getElement(), frame); 59 | } 60 | setFrames(frames) { 61 | this.clearFrames(); 62 | frames.forEach((frame, index) => { 63 | const groupItem = this.addFrame(frame); 64 | if (index === 0) { 65 | this.frameGroupView.activate(groupItem); 66 | } 67 | }); 68 | } 69 | clearFrames() { 70 | this.frameGroupView.removeItems(); 71 | } 72 | getElement() { 73 | return this.viewElement.element; 74 | } 75 | getTitle() { 76 | return 'Debug Navigator'; 77 | } 78 | getURI() { 79 | return DEBUG_NAVIGATOR_URI; 80 | } 81 | getDefaultLocation() { 82 | return 'right'; 83 | } 84 | getAllowedLocations() { 85 | return ['right', 'center', 'left']; 86 | } 87 | destroy() { 88 | atom.workspace.hide(DEBUG_NAVIGATOR_URI); 89 | this.viewElement.element.remove(); 90 | } 91 | }; 92 | DebugNavigatorView = __decorate([ 93 | View({ 94 | name: 'xatom-debug-navigator' 95 | }), 96 | __metadata("design:paramtypes", [ViewElement]) 97 | ], DebugNavigatorView); 98 | export { DebugNavigatorView }; 99 | //# sourceMappingURL=DebugNavigatorView.js.map -------------------------------------------------------------------------------- /lib/debug/DebugNavigatorView.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DebugNavigatorView.js","sourceRoot":"","sources":["../../src2/debug/DebugNavigatorView.ts"],"names":[],"mappings":"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","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { View, ViewElement } from '../View';\nimport { GroupView } from '../GroupView';\nimport { DebugFrameView } from './DebugFrameView';\nimport { CallFrames, CallFrame } from './CallFrame';\n\nexport const DEBUG_NAVIGATOR_URI = 'xatom://debug-navigator';\n\n@View({\n name: 'xatom-debug-navigator'\n})\nexport class DebugNavigatorView {\n public element: HTMLElement;\n public frameGroupView: GroupView;\n public watchGroupView: GroupView;\n public variableGroupView: GroupView;\n constructor (private viewElement: ViewElement) {\n this.element = this.getElement();\n // Variables\n this.variableGroupView = new GroupView(null, {\n title: 'Variables'\n });\n this.element.appendChild(this.variableGroupView.getElement());\n // Watch\n this.watchGroupView = new GroupView(null, {\n title: 'Watch'\n });\n this.element.appendChild(this.watchGroupView.getElement());\n // Call Frames\n this.frameGroupView = new GroupView(null, {\n title: 'Call Frames',\n selectable: true\n });\n this.element.appendChild(this.frameGroupView.getElement());\n }\n // Variables\n addVariable (variable: any) {\n\n }\n setVariables (variables: any) {\n this.clearVariables();\n variables.forEach((variable) => this.addVariable(variable));\n }\n clearVariables () {\n this.variableGroupView.removeItems();\n }\n // Watch\n addWatchVariable (expression: string) {\n //\n }\n // Frames\n addFrame (frame: CallFrame) {\n const item = new DebugFrameView(null, frame);\n return this.frameGroupView.addItem(item.getElement(), frame);\n }\n setFrames (frames: CallFrames) {\n this.clearFrames();\n frames.forEach((frame, index) => {\n const groupItem = this.addFrame(frame);\n if (index === 0) {\n this.frameGroupView.activate(groupItem);\n }\n });\n }\n clearFrames () {\n this.frameGroupView.removeItems();\n }\n getElement () {\n return this.viewElement.element;\n }\n getTitle () {\n return 'Debug Navigator';\n }\n getURI () {\n return DEBUG_NAVIGATOR_URI;\n }\n getDefaultLocation () {\n return 'right';\n }\n getAllowedLocations () {\n return ['right', 'center', 'left'];\n }\n destroy () {\n atom.workspace.hide(DEBUG_NAVIGATOR_URI);\n this.viewElement.element.remove();\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/debug/Variable.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | //# sourceMappingURL=Variable.js.map -------------------------------------------------------------------------------- /lib/debug/Variable.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Variable.js","sourceRoot":"","sources":["../../src2/debug/Variable.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport interface Variable {\n filePath: string;\n functionName: string;\n lineNumber: number;\n columnNumber: number;\n}\n\nexport type Variables = Array;\n"]} -------------------------------------------------------------------------------- /lib/debug/index.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | export * from './DebugAreaView'; 8 | export * from './DebugControlView'; 9 | export * from './DebugFrameView'; 10 | export * from './DebugNavigatorView'; 11 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/debug/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src2/debug/index.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport * from './DebugAreaView';\nexport * from './DebugControlView';\nexport * from './DebugFrameView';\nexport * from './DebugNavigatorView';\nexport * from './CallFrame';\n"]} -------------------------------------------------------------------------------- /lib/plugin/Plugin.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | //# sourceMappingURL=Plugin.js.map -------------------------------------------------------------------------------- /lib/plugin/Plugin.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src2/plugin/Plugin.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\nexport interface Plugin {\n iconPath: string;\n}\n"]} -------------------------------------------------------------------------------- /lib/plugin/PluginManager.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | const { CompositeDisposable, Range, Emitter, Disposable } = require('atom'); 8 | import { createSession } from './PluginSession'; 9 | export class PluginManager { 10 | constructor(toolbarView, debugControlView, debugAreaView, debugNavigatorView) { 11 | this.toolbarView = toolbarView; 12 | this.debugControlView = debugControlView; 13 | this.debugAreaView = debugAreaView; 14 | this.debugNavigatorView = debugNavigatorView; 15 | this.emitter = new Emitter(); 16 | this.plugins = []; 17 | } 18 | execute(functionName, functionArgs) { 19 | const plugin = this.getActivePlugin(); 20 | if (plugin[functionName]) { 21 | plugin[functionName].apply(plugin, functionArgs); 22 | } 23 | } 24 | setActivePlugin(plugin) { 25 | this.activePlugin = plugin; 26 | } 27 | getSession() { 28 | return createSession(this.toolbarView, this.debugControlView, this.debugAreaView, this.debugNavigatorView); 29 | } 30 | getActivePlugin() { 31 | return this.activePlugin; 32 | } 33 | onDidChangePlugins(callback) { 34 | return this.emitter.on('didChangePlugins', callback); 35 | } 36 | addPlugin(name, plugin) { 37 | const item = { 38 | name, 39 | plugin 40 | }; 41 | this.plugins.push(item); 42 | this.activePlugin = plugin; 43 | this.emitter.emit('didChangePlugins', this.plugins); 44 | } 45 | removePlugin(pluginName) { 46 | const index = this.plugins.findIndex((p) => p.name === pluginName); 47 | if (index > -1) 48 | this.plugins.splice(index, 1); 49 | this.emitter.emit('didChangePlugins', this.plugins); 50 | } 51 | destroy() { 52 | this.plugins = []; 53 | this.emitter.dispose(); 54 | } 55 | } 56 | //# sourceMappingURL=PluginManager.js.map -------------------------------------------------------------------------------- /lib/plugin/PluginManager.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PluginManager.js","sourceRoot":"","sources":["../../src2/plugin/PluginManager.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AACH,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAS5E,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG/D,MAAM;IAIJ,YACU,WAAwB,EACxB,gBAAkC,EAClC,aAA4B,EAC5B,kBAAsC;QAHtC,gBAAW,GAAX,WAAW,CAAa;QACxB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,kBAAa,GAAb,aAAa,CAAe;QAC5B,uBAAkB,GAAlB,kBAAkB,CAAoB;QAPxC,YAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAEzB,YAAO,GAAe,EAAE,CAAC;IAKmB,CAAC;IACpD,OAAO,CAAE,YAAoB,EAAE,YAAoB;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACzB,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,eAAe,CAAE,MAAc;QAC7B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;IAC7B,CAAC;IACD,UAAU;QACR,MAAM,CAAC,aAAa,CAClB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,kBAAkB,CACxB,CAAC;IACJ,CAAC;IACD,eAAe;QACb,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,kBAAkB,CAAE,QAAkB;QACpC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IACD,SAAS,CAAE,IAAY,EAAE,MAAW;QAClC,MAAM,IAAI,GAAG;YACX,IAAI;YACJ,MAAM;SACP,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,YAAY,CAAE,UAAkB;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QACnE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,OAAO;QACL,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\nconst { CompositeDisposable, Range, Emitter, Disposable } = require('atom');\nimport { ToolbarView } from '../ToolbarView';\nimport {\n DebugControlView,\n DebugAreaView,\n DebugNavigatorView,\n DEBUG_AREA_URI,\n DEBUG_NAVIGATOR_URI\n} from '../debug';\nimport { PluginSession, createSession } from './PluginSession';\nimport { Plugin } from './Plugin';\n\nexport class PluginManager {\n private emitter = new Emitter();\n private activePlugin: Plugin;\n public plugins: Array = [];\n constructor (\n private toolbarView: ToolbarView,\n private debugControlView: DebugControlView,\n private debugAreaView: DebugAreaView,\n private debugNavigatorView: DebugNavigatorView) {}\n execute (functionName: string, functionArgs?: any[]) {\n const plugin = this.getActivePlugin();\n if (plugin[functionName]) {\n plugin[functionName].apply(plugin, functionArgs);\n }\n }\n setActivePlugin (plugin: Plugin): void {\n this.activePlugin = plugin;\n }\n getSession (): PluginSession {\n return createSession(\n this.toolbarView,\n this.debugControlView,\n this.debugAreaView,\n this.debugNavigatorView\n );\n }\n getActivePlugin (): Plugin {\n return this.activePlugin;\n }\n onDidChangePlugins (callback: Function) {\n return this.emitter.on('didChangePlugins', callback);\n }\n addPlugin (name: string, plugin: any) {\n const item = {\n name,\n plugin\n };\n this.plugins.push(item);\n this.activePlugin = plugin;\n this.emitter.emit('didChangePlugins', this.plugins);\n }\n removePlugin (pluginName: string) {\n const index = this.plugins.findIndex((p) => p.name === pluginName);\n if (index > -1) this.plugins.splice(index, 1);\n this.emitter.emit('didChangePlugins', this.plugins);\n }\n destroy () {\n this.plugins = [];\n this.emitter.dispose();\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/plugin/PluginSession.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | /*! 11 | * XAtom Debug 12 | * Copyright(c) 2017 Williams Medina 13 | * MIT Licensed 14 | */ 15 | import { XAtom } from '../XAtom'; 16 | import { DEBUG_NAVIGATOR_URI, DEBUG_AREA_URI } from '../debug'; 17 | import { BREAKPOINT_NAVIGATOR_URI } from '../breakpoint'; 18 | import { Location } from '../Location'; 19 | export function createSession(toolbarView, debugControlView, debugAreaView, debugNavigatorView) { 20 | let currentLocation; 21 | return { 22 | getControlOptions() { 23 | return new Promise((resolve, reject) => { 24 | resolve({ 25 | pauseOnException: debugControlView.isPauseOnExceptionEnabled(), 26 | disableBreakpoints: debugControlView.isBreakpointsDisabled() 27 | }); 28 | }); 29 | }, 30 | getSchemeOptions() { 31 | const editor = atom.workspace.getCenter().getActivePaneItem(); 32 | if (!atom.workspace.isTextEditor(editor)) 33 | return; 34 | return new Promise((resolve, reject) => { 35 | resolve({ 36 | currentPath: editor.getPath() 37 | }); 38 | }); 39 | }, 40 | getBreakpoints() { 41 | return XAtom.breakpoints.get(); 42 | }, 43 | markLocation(location, type) { 44 | return __awaiter(this, void 0, void 0, function* () { 45 | if (currentLocation) 46 | currentLocation.destroy(); 47 | return currentLocation = new Location(location, type); 48 | }); 49 | }, 50 | markException(location) { 51 | return __awaiter(this, void 0, void 0, function* () { 52 | return this.markLocation(location, 'exception'); 53 | }); 54 | }, 55 | // async markBreakpoint (location: Breakpoint) { 56 | // return this.markLocation(location, 'breakpoint'); 57 | // }, 58 | setFrames(frames) { 59 | debugNavigatorView.setFrames(frames); 60 | }, 61 | status(o) { 62 | toolbarView.setStatusText(o.text); 63 | toolbarView.setStatusLoading(o.loading || false); 64 | toolbarView.setStatusState(o.type || ''); 65 | }, 66 | pause() { 67 | debugControlView.enableControls(); 68 | }, 69 | resume() { 70 | debugControlView.disableControls(); 71 | }, 72 | start() { 73 | toolbarView.disableControls(); 74 | debugControlView.show(); 75 | atom.workspace.open(DEBUG_AREA_URI, {}); 76 | atom.workspace.open(BREAKPOINT_NAVIGATOR_URI, {}); 77 | atom.workspace.open(DEBUG_NAVIGATOR_URI, {}); 78 | }, 79 | end() { 80 | if (currentLocation) 81 | currentLocation.destroy(); 82 | toolbarView.enableControls(); 83 | debugControlView.hide(); 84 | atom.workspace.hide(DEBUG_AREA_URI); 85 | atom.workspace.hide(DEBUG_NAVIGATOR_URI); 86 | } 87 | }; 88 | } 89 | //# sourceMappingURL=PluginSession.js.map -------------------------------------------------------------------------------- /lib/plugin/PluginSession.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PluginSession.js","sourceRoot":"","sources":["../../src2/plugin/PluginSession.ts"],"names":[],"mappings":"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","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\nimport { XAtom } from '../XAtom';\nimport {\n DebugControlView,\n DebugNavigatorView,\n DebugAreaView,\n CallFrames,\n DEBUG_NAVIGATOR_URI,\n DEBUG_AREA_URI\n} from '../debug';\nimport { Breakpoint, BREAKPOINT_NAVIGATOR_URI } from '../breakpoint';\nimport { Location } from '../Location';\n\nexport interface PluginSession {\n getControlOptions (): void;\n getSchemeOptions (): void;\n start (): void;\n end (): void;\n status (options: {\n text: string,\n type?: 'error' | 'warning' | 'success',\n loading: boolean\n }): void;\n}\n\nexport function createSession (\n toolbarView,\n debugControlView: DebugControlView,\n debugAreaView: DebugAreaView,\n debugNavigatorView: DebugNavigatorView) {\n let currentLocation;\n return {\n getControlOptions (): Promise {\n return new Promise((resolve, reject) => {\n resolve({\n pauseOnException: debugControlView.isPauseOnExceptionEnabled(),\n disableBreakpoints: debugControlView.isBreakpointsDisabled()\n });\n });\n },\n getSchemeOptions (): Promise {\n const editor = atom.workspace.getCenter().getActivePaneItem();\n if (!atom.workspace.isTextEditor(editor)) return;\n return new Promise((resolve, reject) => {\n resolve({\n currentPath: editor.getPath()\n });\n });\n },\n getBreakpoints (): Promise {\n return XAtom.breakpoints.get();\n },\n async markLocation (location: Breakpoint, type?: string) {\n if (currentLocation) currentLocation.destroy();\n\n return currentLocation = new Location(location, type);\n },\n async markException (location: Breakpoint) {\n return this.markLocation(location, 'exception');\n },\n // async markBreakpoint (location: Breakpoint) {\n // return this.markLocation(location, 'breakpoint');\n // },\n setFrames (frames: CallFrames) {\n debugNavigatorView.setFrames(frames);\n },\n status (o): void {\n toolbarView.setStatusText(o.text);\n toolbarView.setStatusLoading(o.loading || false);\n toolbarView.setStatusState(o.type || '');\n },\n pause () {\n debugControlView.enableControls();\n },\n resume () {\n debugControlView.disableControls();\n },\n start (): void {\n toolbarView.disableControls();\n debugControlView.show();\n atom.workspace.open(DEBUG_AREA_URI, {});\n atom.workspace.open(BREAKPOINT_NAVIGATOR_URI, {});\n atom.workspace.open(DEBUG_NAVIGATOR_URI, {});\n },\n end (): void {\n if (currentLocation) currentLocation.destroy();\n toolbarView.enableControls();\n debugControlView.hide();\n atom.workspace.hide(DEBUG_AREA_URI);\n atom.workspace.hide(DEBUG_NAVIGATOR_URI);\n }\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/plugin/index.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | export * from './PluginManager'; 3 | export * from './PluginSession'; 4 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/plugin/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src2/plugin/index.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AAQZ,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport * from './Plugin';\nexport * from './PluginManager';\nexport * from './PluginSession';\n"]} -------------------------------------------------------------------------------- /lib/storage/Collection.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | /*! 11 | * XAtom Debug 12 | * Copyright(c) 2017 Williams Medina 13 | * MIT Licensed 14 | */ 15 | const path = require('path'); 16 | const Datastore = require('nedb'); 17 | const storagePath = path.resolve(atom['configDirPath'], 'storage', 'xatom'); 18 | export class Collection { 19 | constructor(filename) { 20 | this.filename = filename; 21 | this.db = new Datastore(path.join(storagePath), `${filename}.db`); 22 | } 23 | connect() { 24 | return new Promise((resolve, reject) => { 25 | return this.db.loadDatabase((err) => { 26 | if (err) { 27 | reject(); 28 | } 29 | else { 30 | resolve(this.db); 31 | } 32 | }); 33 | }); 34 | } 35 | insert(data) { 36 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 37 | const db = yield this.connect(); 38 | db.insert(data, (err, data) => { 39 | if (err) 40 | reject(err); 41 | resolve(data); 42 | }); 43 | })); 44 | } 45 | remove(data) { 46 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 47 | const db = yield this.connect(); 48 | db.remove(data, (err, data) => { 49 | if (err) 50 | reject(err); 51 | resolve(data); 52 | }); 53 | })); 54 | } 55 | findOne(options) { 56 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 57 | const db = yield this.connect(); 58 | db.findOne(options, (err, data) => { 59 | if (err) 60 | reject(err); 61 | resolve(data); 62 | }); 63 | })); 64 | } 65 | find(options) { 66 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 67 | const db = yield this.connect(); 68 | db.find(options, (err, data) => { 69 | if (err) 70 | reject(err); 71 | resolve(data); 72 | }); 73 | })); 74 | } 75 | } 76 | //# sourceMappingURL=Collection.js.map -------------------------------------------------------------------------------- /lib/storage/Collection.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Collection.js","sourceRoot":"","sources":["../../src2/storage/Collection.ts"],"names":[],"mappings":"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","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nconst path = require('path');\nconst Datastore = require('nedb');\nconst storagePath = path.resolve(atom['configDirPath'], 'storage', 'xatom');\n\nexport class Collection {\n private db;\n constructor (private filename: string) {\n this.db = new Datastore(path.join(storagePath), `${filename}.db`);\n }\n connect (): Promise {\n return new Promise((resolve, reject) => {\n return this.db.loadDatabase((err) => {\n if (err) {\n reject();\n } else {\n resolve(this.db);\n }\n })\n });\n }\n insert (data: any) {\n return new Promise(async (resolve, reject) => {\n const db = await this.connect();\n db.insert(data, (err, data) => {\n if (err) reject(err);\n resolve(data);\n });\n });\n }\n remove (data: any) {\n return new Promise(async (resolve, reject) => {\n const db = await this.connect();\n db.remove(data, (err, data) => {\n if (err) reject(err);\n resolve(data);\n });\n });\n }\n findOne (options: any) {\n return new Promise(async (resolve, reject) => {\n const db = await this.connect();\n db.findOne(options, (err, data) => {\n if (err) reject(err);\n resolve(data);\n });\n });\n }\n find (options: any): Promise {\n return new Promise(async (resolve, reject) => {\n const db = await this.connect();\n db.find(options, (err, data) => {\n if (err) reject(err);\n resolve(data);\n });\n });\n }\n}\n"]} -------------------------------------------------------------------------------- /lib/storage/Item.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | //# sourceMappingURL=Item.js.map -------------------------------------------------------------------------------- /lib/storage/Item.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../src2/storage/Item.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport interface Item {\n _id?: string;\n}\n"]} -------------------------------------------------------------------------------- /lib/storage/Storage.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { Collection } from './Collection'; 8 | export var Storage; 9 | (function (Storage) { 10 | Storage.project = new Collection('projects'); 11 | Storage.breakpoint = new Collection('breakpoints'); 12 | Storage.expression = new Collection('expressions'); 13 | })(Storage || (Storage = {})); 14 | //# sourceMappingURL=Storage.js.map -------------------------------------------------------------------------------- /lib/storage/Storage.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../src2/storage/Storage.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,KAAW,OAAO,CAMvB;AAND,WAAiB,OAAO;IAET,eAAO,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IACrC,kBAAU,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IAC3C,kBAAU,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;AAE1D,CAAC,EANgB,OAAO,KAAP,OAAO,QAMvB","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nimport { Collection } from './Collection';\n\nexport namespace Storage {\n\n export const project = new Collection('projects');\n export const breakpoint = new Collection('breakpoints');\n export const expression = new Collection('expressions');\n\n}\n"]} -------------------------------------------------------------------------------- /lib/storage/index.js: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | export * from './Storage'; 8 | export * from './Collection'; 9 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/storage/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src2/storage/index.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;AACZ;;;;GAIG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC","sourcesContent":["'use babel';\n/*!\n * XAtom Debug\n * Copyright(c) 2017 Williams Medina \n * MIT Licensed\n */\n\nexport * from './Storage';\nexport * from './Collection';\nexport * from './Item';\n"]} -------------------------------------------------------------------------------- /menus/xatom-debug.json: -------------------------------------------------------------------------------- 1 | { 2 | "menu": [{ 3 | "label": "Packages", 4 | "submenu": [{ 5 | "label": "XAtom", 6 | "submenu": [{ 7 | "label": "Debugger", 8 | "submenu": [{ 9 | "label": "Toggle", 10 | "command": "xatom-debug:toggle" 11 | }, { 12 | "label": "Run", 13 | "command": "xatom-debug:run" 14 | }, { 15 | "label": "Stop", 16 | "command": "xatom-debug:stop" 17 | }] 18 | }] 19 | }] 20 | }], 21 | "context-menu": { 22 | "atom-text-editor": [{ 23 | "label": "XAtom", 24 | "submenu": [{ 25 | "label": "Debugger", 26 | "submenu": [{ 27 | "label": "Toggle", 28 | "command": "xatom-debug:toggle" 29 | }, { 30 | "label": "Run", 31 | "command": "xatom-debug:run" 32 | }, { 33 | "label": "Stop", 34 | "command": "xatom-debug:stop" 35 | }] 36 | }] 37 | }], 38 | "xatom-debug-toolbar": [{ 39 | "label": "XAtom", 40 | "submenu": [{ 41 | "label": "Debugger", 42 | "submenu": [{ 43 | "label": "Toggle", 44 | "command": "xatom-debug:toggle" 45 | }, { 46 | "label": "Run", 47 | "command": "xatom-debug:run" 48 | }, { 49 | "label": "Stop", 50 | "command": "xatom-debug:stop" 51 | }] 52 | }] 53 | }], 54 | ".xatom-breakpoint": [{ 55 | "label": "Edit Breakpoint", 56 | "command": "xatom-debug:edit-breakpoint" 57 | }, { 58 | "label": "Remove Breakpoint", 59 | "command": "xatom-debug:remove-breakpoint" 60 | }, { 61 | "type": "separator" 62 | }], 63 | ".line-number": [{ 64 | "label": "Add Breakpoint", 65 | "command": "xatom-debug:add-breakpoint" 66 | }, { 67 | "type": "separator" 68 | }] 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xatom-debug", 3 | "version": "1.6.11", 4 | "author": "Williams Medina ", 5 | "description": "A Simple Debugger for Atom", 6 | "keywords": [ 7 | "javascript", 8 | "debugger", 9 | "debug", 10 | "atom", 11 | "repl", 12 | "bugs", 13 | "chrome", 14 | "browser", 15 | "willyelm", 16 | "node", 17 | "breakpoint", 18 | "console" 19 | ], 20 | "license": "MIT", 21 | "repository": "https://github.com/willyelm/xatom-debug", 22 | "main": "./lib/Package", 23 | "showWelcome": true, 24 | "scripts": { 25 | "start": "tsc -w" 26 | }, 27 | "engines": { 28 | "atom": ">=1.16.0 <2.0.0" 29 | }, 30 | "providedServices": { 31 | "xatom-debug": { 32 | "versions": { 33 | "1.0.0": "providePlugin" 34 | } 35 | } 36 | }, 37 | "configSchema": { 38 | "toolbarStyle": { 39 | "title": "Toolbar Style", 40 | "description": "Change toolbar panel position.", 41 | "type": "string", 42 | "default": "HeaderPanel", 43 | "enum": [ 44 | { 45 | "value": "FooterPanel", 46 | "description": "Footer" 47 | }, 48 | { 49 | "value": "HeaderPanel", 50 | "description": "Header" 51 | } 52 | ] 53 | }, 54 | "showToolbar": { 55 | "title": "Show Toolbar", 56 | "description": "Show debug toolbar when atom starts.", 57 | "type": "boolean", 58 | "default": true 59 | } 60 | }, 61 | "package-deps": [ 62 | "xatom-debug-nodejs" 63 | ], 64 | "deserializers": { 65 | "XAtom/BreakpointNavigatorView": "deserializeBreakpointNavigatorView" 66 | }, 67 | "dependencies": { 68 | "atom-package-deps": "^4.6.0", 69 | "lodash": "^4.17.4", 70 | "nedb": "^1.8.0", 71 | "node-pty": "^0.7.0", 72 | "resize-observer-polyfill": "^1.4.2", 73 | "xterm": "^4.1.0" 74 | }, 75 | "devDependencies": { 76 | "@types/atom": "0.0.36", 77 | "@types/lodash": "^4.14.74", 78 | "@types/node": "^7.0.43", 79 | "reflect-metadata": "^0.1.10", 80 | "typescript": "^2.5.2" 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/ConsoleView.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { 8 | createGroupButtons, 9 | createButton, 10 | createIcon, 11 | createIconFromPath, 12 | createText, 13 | createElement, 14 | insertElement, 15 | attachEventFromObject 16 | } from './element' 17 | 18 | import { EventEmitter } from 'events' 19 | import { parse } from 'path' 20 | 21 | export interface ConsoleOptions { 22 | didRequestProperties?: Function 23 | } 24 | export class ConsoleView { 25 | 26 | private element: HTMLElement 27 | private outputElement: HTMLElement 28 | private events: EventEmitter 29 | 30 | constructor (options?: ConsoleOptions) { 31 | this.events = new EventEmitter() 32 | this.outputElement = createElement('xatom-debug-console-output') 33 | this.element = createElement('xatom-debug-console', { 34 | elements: [ 35 | createElement('xatom-debug-controls', { 36 | elements: [ 37 | createButton({}, createText('Console')) 38 | ] 39 | }), 40 | this.outputElement 41 | ] 42 | }) 43 | this.element.setAttribute('tabindex', '-1') 44 | attachEventFromObject(this.events, [ 45 | 'didRequestProperties' 46 | ], options) 47 | } 48 | 49 | clearConsole () { 50 | this.outputElement.innerHTML = '' 51 | } 52 | 53 | requestProperties (result: any, inspectorView: any) { 54 | this.events.emit('didRequestProperties', result, inspectorView) 55 | } 56 | 57 | createEmptyLine (options?) { 58 | let line = createElement('xatom-debug-console-line', options) 59 | insertElement(this.outputElement, line) 60 | return line 61 | } 62 | 63 | createConsoleLine (entry: string, options?) { 64 | let line = createElement('xatom-debug-console-line', options) 65 | if (entry && entry.length > 0) { 66 | line.innerHTML = entry 67 | } 68 | setTimeout (() => { 69 | this.outputElement.scrollTop = this.outputElement.scrollHeight 70 | }, 250) 71 | return insertElement(this.outputElement, line) 72 | } 73 | 74 | getElement () { 75 | return this.element 76 | } 77 | 78 | destroy () { 79 | this.element.remove() 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/ExpressionManager.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { EventEmitter } from 'events' 9 | 10 | export interface Expression { 11 | text: string, 12 | element: any 13 | } 14 | 15 | export type Expressions = Array 16 | 17 | export class ExpressionManager { 18 | 19 | private expressions: Expressions = [] 20 | 21 | constructor () {} 22 | 23 | public getExpressions (): Expressions { 24 | return this.expressions 25 | } 26 | 27 | // getExpressionsFromFile(filePath: String): Expressions { 28 | // return this.expressions.filter((item) => { 29 | // return (item.filePath === filePath) 30 | // }) 31 | // } 32 | 33 | removeExpression (Expression: Expression): Promise { 34 | return new Promise ((resolve, reject) => { 35 | let index = this.expressions.indexOf(Expression) 36 | if(index != -1) { 37 | // if (expression.marker) Expression.marker.destroy() 38 | // this.expressions.splice(index, 1) 39 | return resolve(true) 40 | } 41 | return reject('Expression does not exists') 42 | }) 43 | } 44 | 45 | addExpression (text: string, element: any): Promise { 46 | return new Promise((resolve, reject) => { 47 | let expression = { 48 | text, 49 | element 50 | } as Expression 51 | let index = this.expressions.push(expression) 52 | if (index > -1) { 53 | resolve(expression) 54 | } else { 55 | reject('Unable to add Expression') 56 | } 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/editor/BreakpointManager.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { EventEmitter } from 'events' 9 | 10 | export interface Breakpoint { 11 | lineNumber: number, 12 | filePath: string, 13 | condition: string, 14 | marker: any 15 | } 16 | 17 | export type Breakpoints = Array 18 | 19 | export class BreakpointManager { 20 | 21 | private breakpoints: Breakpoints = [] 22 | 23 | constructor () {} 24 | 25 | public getBreakpoints (): Breakpoints { 26 | return this.breakpoints 27 | } 28 | 29 | getBreakpoint (filePath: String, lineNumber: Number): Breakpoint { 30 | let index = this.breakpoints.findIndex((item) => { 31 | return (item.filePath === filePath && item.lineNumber === lineNumber) 32 | }) 33 | return this.breakpoints[index] 34 | } 35 | 36 | getBreakpointsFromFile(filePath: String): Breakpoints { 37 | return this.breakpoints.filter((item) => { 38 | return (item.filePath === filePath) 39 | }) 40 | } 41 | 42 | removeBreakpoint (breakpoint: Breakpoint): Promise { 43 | return new Promise ((resolve, reject) => { 44 | let index = this.breakpoints.indexOf(breakpoint) 45 | if(index != -1) { 46 | if (breakpoint.marker) breakpoint.marker.destroy() 47 | this.breakpoints.splice(index, 1) 48 | return resolve(true) 49 | } 50 | return reject('Breakpoint does not exists') 51 | }) 52 | } 53 | 54 | addBreakpoint (marker: any, lineNumber: number, filePath: string, condition?: string): Promise { 55 | return new Promise((resolve, reject) => { 56 | let breakpoint = { 57 | lineNumber, 58 | filePath, 59 | marker, 60 | condition: condition || '' 61 | } as Breakpoint 62 | let index = this.breakpoints.push(breakpoint) 63 | if (index > -1) { 64 | resolve(breakpoint) 65 | } else { 66 | reject('Unable to add breakpoint') 67 | } 68 | }) 69 | } 70 | getPlainBreakpoints (): Breakpoints { 71 | return this.breakpoints.map((b) => { 72 | return { 73 | filePath: b.filePath, 74 | lineNumber: b.lineNumber, 75 | condition: b.condition 76 | } as Breakpoint 77 | }) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/editor/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './BreakpointManager' 9 | export * from './EditorManager' 10 | -------------------------------------------------------------------------------- /src/element/button.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { insertElement, createElement } from './element' 9 | 10 | export function createGroupButtons (options, elements?) { 11 | return createElement('div', { 12 | className: `btn-group`, 13 | elements: elements || options, 14 | options 15 | }); 16 | } 17 | 18 | export function createButton (options, elements?) { 19 | return createElement('button', { 20 | className: `btn btn-default`, 21 | elements: elements || options, 22 | options 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /src/element/element.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export function createText (text: string): Text { 9 | return document.createTextNode(`${text}`); 10 | } 11 | 12 | export function insertElement (target: HTMLElement, elements) { 13 | if (!Array.isArray(elements)) { 14 | elements = [ elements ] 15 | } 16 | elements.forEach((el) => target.appendChild(el)); 17 | return target; 18 | } 19 | 20 | export function createElement (tagName, options?) { 21 | let element = document.createElement(tagName); 22 | if (options) { 23 | let extras = options.options || {}; 24 | if (options.className) { 25 | element.className = options.className; 26 | } 27 | if (options.id) { 28 | element.setAttribute('id', options.id); 29 | } 30 | if (extras.tooltip) { 31 | extras.tooltip['subscriptions'].add(atom['tooltips'].add(element, { 32 | title: extras.tooltip.title || '' 33 | })); 34 | } 35 | if (extras.className) { 36 | element.classList.add(extras.className) 37 | } 38 | if (extras.click) { 39 | element.addEventListener('click', (e) => { 40 | extras.click(e); 41 | }); 42 | } 43 | if (extras.change) { 44 | element.addEventListener('change', (e) => extras.change(e.target.value, e)); 45 | } 46 | if (extras.disabled) { 47 | element['disabled'] = extras.disabled; 48 | } 49 | if (options.elements) { 50 | let contents = Array.isArray(options.elements) ? options.elements: [options.elements]; 51 | contents.forEach((content) => insertElement(element, content)) 52 | } 53 | } 54 | return element; 55 | } 56 | -------------------------------------------------------------------------------- /src/element/events.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export function attachEventFromObject (instance: any, names: Array, options) { 9 | names.forEach((listenerName) => { 10 | if (options[listenerName] && typeof options[listenerName] === 'function') { 11 | instance.on(listenerName, options[listenerName]) 12 | } 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /src/element/icon.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export function createIcon (name: string) { 9 | let icon = document.createElement('i'); 10 | icon.className = `xatom-icon xatom-icon-${name}`; 11 | icon.innerHTML = ' ' 12 | return icon; 13 | } 14 | 15 | export function createIconFromPath (path: string) { 16 | let icon = document.createElement('i'); 17 | icon.className = `xatom-icon`; 18 | icon.style.backgroundImage = `url(${path})` 19 | return icon; 20 | } 21 | -------------------------------------------------------------------------------- /src/element/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './button' 9 | export * from './icon' 10 | export * from './element' 11 | export * from './select' 12 | export * from './input' 13 | export * from './events' 14 | -------------------------------------------------------------------------------- /src/element/input.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { get } from 'lodash' 9 | import { insertElement, createElement, createText } from './element' 10 | 11 | export function createTextEditor (options) { 12 | let input = document.createElement('atom-text-editor') 13 | input.setAttribute('mini', 'true') 14 | let editor = input['getModel']() 15 | if (options.placeholder) { 16 | editor.setPlaceholderText(options.placeholder) 17 | } 18 | if (options.change) { 19 | editor.onDidChange(() => { 20 | let text = editor.getText() 21 | options.change(text) 22 | }) 23 | } 24 | if (options.value) { 25 | editor.setText(options.value) 26 | } 27 | if (options.keyEvents) { 28 | input.addEventListener('keyup', (e) => { 29 | if (options.keyEvents[e.keyCode]) { 30 | options.keyEvents[e.keyCode]() 31 | } 32 | }) 33 | } 34 | return input 35 | } 36 | 37 | export function createInput (options) { 38 | let input = createElement('input') 39 | let handler = null 40 | let inputType = 'text' 41 | let className = 'form-control' 42 | if (options.placeholder) { 43 | input.setAttribute('placeholder', options.placeholder) 44 | } 45 | if (options.type) { 46 | inputType = options.type 47 | } 48 | if (options.className) { 49 | className = options.className 50 | } 51 | if (get(options, 'value')) { 52 | switch(inputType) { 53 | case 'text': 54 | input.value = options.value 55 | break 56 | case 'checkbox': 57 | input.checked = options.value 58 | break 59 | } 60 | } 61 | if (options.readOnly === true) { 62 | input.setAttribute('readonly', true) 63 | } 64 | input.className = className; 65 | input.setAttribute('type', inputType) 66 | if (options.change) { 67 | switch(inputType) { 68 | case 'text': 69 | input.addEventListener('keydown', (e) => { 70 | clearTimeout(handler) 71 | handler = setTimeout(() => { 72 | options.change(input.value) 73 | }, 500) 74 | }) 75 | break 76 | case 'checkbox': 77 | input.addEventListener('change', (e) => options.change(input.checked)) 78 | break 79 | } 80 | } 81 | return input 82 | } 83 | -------------------------------------------------------------------------------- /src/element/select.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { insertElement, createElement, createText } from './element' 9 | 10 | export function createSelect (options, elements?) { 11 | return createElement('select', { 12 | elements: elements || options, 13 | options: elements ? options : null 14 | }); 15 | } 16 | 17 | export function createOption (name: string, value: string) { 18 | let option = createElement('option', { 19 | elements: [createText(name)] 20 | }); 21 | option.setAttribute('value', value); 22 | return option; 23 | } 24 | -------------------------------------------------------------------------------- /src/greet.ts: -------------------------------------------------------------------------------- 1 | import { Person } from './person'; 2 | 3 | export function Greet (person: Person) { 4 | return `Hi!, my name is ${person.name}` 5 | } 6 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { XAtomDebug } from './XAtomDebug' 8 | const { CompositeDisposable } = require('atom') 9 | 10 | export default { 11 | subscriptions: null, 12 | toolbarPanel: null, 13 | debugPanel: null, 14 | consolePanel: null, 15 | debug: null, 16 | 17 | activate (state: any) { 18 | require('atom-package-deps').install('xatom-debug', true) 19 | // create atom bugs instance 20 | this.debug = new XAtomDebug(); 21 | this.debug.toolbarView.didRun(() => { 22 | this.consolePanel.show() 23 | this.debugPanel.show() 24 | this.debug.debugView.adjustDebugArea() 25 | }) 26 | this.debug.toolbarView.didStop(() => { 27 | this.consolePanel.hide() 28 | this.debugPanel.hide() 29 | }) 30 | this.debug.toolbarView.didToggleConsole(() => { 31 | this.consolePanel[this.consolePanel.visible ? 'hide' : 'show']() 32 | }) 33 | this.debug.toolbarView.didToggleDebugArea(() => { 34 | this.debugPanel[this.debugPanel.visible ? 'hide' : 'show']() 35 | this.debug.debugView.adjustDebugArea() 36 | }) 37 | // set Paths 38 | let projects = atom.project['getPaths']() 39 | this.debug.toolbarView.setPaths(projects) 40 | // observe path changes 41 | atom.project.onDidChangePaths((projects) => this.debug.toolbarView.setPaths(projects)) 42 | // Toolbar Panel 43 | atom.config['observe']('xatom-debug.toolbarStyle', (value) => { 44 | if (value === 'HeaderPanel') { 45 | this.debug.toolbarView.displayAsTitleBar() 46 | } else { 47 | this.debug.toolbarView.displayDefault() 48 | } 49 | if (this.toolbarPanel) { 50 | this.toolbarPanel.destroy() 51 | this.toolbarPanel = atom.workspace[`add${value}`]({ 52 | item: this.debug.getToolbarElement(), 53 | visible: atom.config.get('xatom-debug.showToolbar') 54 | }); 55 | } 56 | }) 57 | atom.config['observe']('xatom-debug.showToolbar', (value) => { 58 | const method = atom.config.get('xatom-debug.toolbarStyle'); 59 | this.toolbarPanel = atom.workspace[`add${method}`]({ 60 | item: this.debug.getToolbarElement(), 61 | visible: value 62 | }); 63 | }) 64 | // Console Panel 65 | this.consolePanel = atom.workspace.addBottomPanel({ 66 | item: this.debug.getConsoleElement(), 67 | visible: false 68 | }); 69 | // Debug Area Panel 70 | this.debugPanel = atom.workspace.addRightPanel({ 71 | item: this.debug.getDebugAreaElement(), 72 | visible: false 73 | }); 74 | // add commands 75 | let commands = atom.commands.add('atom-workspace', { 76 | 'xatom-debug:toggle': () => { 77 | if (this.toolbarPanel.visible) { 78 | this.toolbarPanel.hide() 79 | this.debugPanel.hide() 80 | this.consolePanel.hide() 81 | } else { 82 | this.toolbarPanel.show() 83 | this.debugPanel.show() 84 | if (this.debug.toolbarView.isRunning) { 85 | this.consolePanel.hide() 86 | } 87 | } 88 | }, 89 | 'xatom-debug:run': () => this.debug.pluginManager.run({}), 90 | 'xatom-debug:stop': () => this.debug.pluginManager.stop(), 91 | 'xatom-debug:pause': () => this.debug.pluginManager.pause(), 92 | 'xatom-debug:step-over': () => this.debug.pluginManager.stepOver(), 93 | 'xatom-debug:step-into': () => this.debug.pluginManager.stepInto(), 94 | 'xatom-debug:step-out': () => this.debug.pluginManager.stepOut(), 95 | 'xatom-debug:add-breakpoint': (event) => { 96 | let editor = atom.workspace.getActiveTextEditor() 97 | this.debug.editorManager.addBreakpointFromEvent(event, editor) 98 | }, 99 | 'xatom-debug:edit-breakpoint': (event) => { 100 | this.debug.editorManager.editBreakpointFromEvent(event) 101 | }, 102 | 'xatom-debug:remove-breakpoint': (event) => { 103 | this.debug.editorManager.removeBreakpointFromEvent(event) 104 | } 105 | }); 106 | this.subscriptions = new CompositeDisposable(); 107 | // add commands subs 108 | this.subscriptions.add(commands); 109 | }, 110 | 111 | provideXAtomDebugPlugin () { 112 | return this.debug.pluginManager; 113 | }, 114 | 115 | deactivate () { 116 | this.subscriptions.dispose(); 117 | // destroys views 118 | this.debug.destroy(); 119 | // destroy panels 120 | this.toolbarPanel.destroy(); 121 | this.debugPanel.destroy(); 122 | this.consolePanel.destroy(); 123 | } 124 | }; 125 | -------------------------------------------------------------------------------- /src/person.ts: -------------------------------------------------------------------------------- 1 | export interface Person { 2 | name: string, 3 | age: number, 4 | active: boolean, 5 | dateOfBirth: Date 6 | }; 7 | -------------------------------------------------------------------------------- /src/plugin/PluginClient.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { 8 | createGroupButtons, 9 | createButton, 10 | createIcon, 11 | createIconFromPath, 12 | createText, 13 | createElement, 14 | insertElement, 15 | attachEventFromObject 16 | } from '../element/index' 17 | import { SchemeView } from '../SchemeView' 18 | import { ToolbarView } from '../ToolbarView' 19 | import { InspectorView } from '../InspectorView' 20 | 21 | import { ConsoleView } from '../ConsoleView' 22 | import { DebugAreaView, CallStackFrames } from '../DebugAreaView' 23 | 24 | import { EditorManager, Breakpoints } from '../editor/index' 25 | import { join } from 'path' 26 | import { get } from 'lodash' 27 | 28 | export class PluginClientConsole { 29 | constructor (private consoleView: ConsoleView) {} 30 | log (message: string): void { 31 | this.consoleView.createConsoleLine(message) 32 | } 33 | info (message: string): void { 34 | this.consoleView.createConsoleLine(message, { 35 | className: 'line-info' 36 | }) 37 | } 38 | error (message: string): void { 39 | this.consoleView.createConsoleLine(message, { 40 | className: 'line-error' 41 | }) 42 | } 43 | output (type: string, items: Array) { 44 | let lineElement = this.consoleView.createEmptyLine({ 45 | className: `line-${type}` 46 | }) 47 | items.forEach((result) => { 48 | if (result.type === 'object') { 49 | result = [{ 50 | value: result 51 | }] 52 | } 53 | let inspector = new InspectorView({ 54 | result, 55 | didRequestProperties: (props, inspectorView) => { 56 | this.consoleView.requestProperties(props, inspectorView) 57 | } 58 | }) 59 | insertElement(lineElement, inspector.getElement()) 60 | }) 61 | } 62 | clear (): void { 63 | this.consoleView.clearConsole() 64 | } 65 | } 66 | 67 | export class PluginClientStatus { 68 | constructor (private toolbarView: ToolbarView) {} 69 | startLoading (): void { 70 | this.toolbarView.setStatusLoading(true) 71 | } 72 | stopLoading (): void { 73 | this.toolbarView.setStatusLoading(false) 74 | } 75 | update (message: string, icon?: string): void { 76 | this.toolbarView.setStatus(message, icon) 77 | } 78 | reset (): void { 79 | this.toolbarView.resetStatus() 80 | } 81 | } 82 | 83 | export interface ClientOptions { 84 | debugView: DebugAreaView, 85 | toolbarView: ToolbarView, 86 | consoleView: ConsoleView, 87 | schemeView: SchemeView, 88 | editorManager: EditorManager 89 | } 90 | 91 | export class PluginClient { 92 | public console: PluginClientConsole 93 | public status: PluginClientStatus 94 | private debugView: DebugAreaView 95 | private consoleView: ConsoleView 96 | private schemeView: SchemeView 97 | private toolbarView: ToolbarView 98 | private editorManager: EditorManager 99 | constructor (private options: ClientOptions) { 100 | this.debugView = options.debugView 101 | this.toolbarView = options.toolbarView 102 | this.schemeView = options.schemeView 103 | this.consoleView = options.consoleView 104 | this.editorManager = options.editorManager 105 | this.console = new PluginClientConsole(this.consoleView) 106 | this.status = new PluginClientStatus(this.toolbarView) 107 | } 108 | stop (): void { 109 | this.debugView.togglePause(false) 110 | this.toolbarView.toggleRun(true) 111 | this.editorManager.removeMarkers() 112 | this.debugView.clearCallStack() 113 | this.debugView.clearScope() 114 | } 115 | run (): void { 116 | this.toolbarView.toggleRun(false) 117 | this.consoleView.clearConsole() 118 | } 119 | pause (): void { 120 | this.debugView.togglePause(true) 121 | // this.debugView.setPausedScript(filePath, lineNumber) 122 | } 123 | resume (): void { 124 | this.debugView.togglePause(false) 125 | this.debugView.clearCallStack() 126 | this.debugView.clearScope() 127 | } 128 | getPathFromFile (file: string) { 129 | return join(this.toolbarView.getPathName(), file) 130 | } 131 | getPath (file: string) { 132 | return this.toolbarView.getPathName() 133 | } 134 | getOptions () { 135 | return this.schemeView.getActivePluginOptions() 136 | } 137 | getBreakpoints (): Breakpoints { 138 | return this.editorManager.breakpointManager.getBreakpoints() 139 | } 140 | activateBreakpoint (filePath: string, lineNumber: number): void { 141 | this.editorManager.breakOnFile(filePath, lineNumber) 142 | } 143 | setCallStack (items: CallStackFrames) { 144 | this.debugView.insertCallStackFromFrames(items) 145 | } 146 | setScope (scope: any) { 147 | this.debugView.insertScopeVariables(scope) 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/plugin/PluginManager.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { EventEmitter } from 'events'; 9 | 10 | export interface Plugin { 11 | iconPath: string, 12 | name: string, 13 | options: any 14 | } 15 | 16 | export class PluginManager { 17 | 18 | public plugins: Array; 19 | public activePlugin: Plugin; 20 | public events: EventEmitter; 21 | 22 | constructor () { 23 | this.plugins = []; 24 | this.events = new EventEmitter(); 25 | } 26 | 27 | activatePlugin (plugin: Plugin) { 28 | this.activePlugin = plugin; 29 | } 30 | 31 | public didAddPlugin (callback) { 32 | this.events.on('addPlugin', callback); 33 | } 34 | 35 | private callOnActivePlugin (actionName, args?) { 36 | if (this.activePlugin && this.activePlugin[actionName]) { 37 | this.activePlugin[actionName].apply(this.activePlugin, args || []); 38 | } 39 | } 40 | 41 | public requestProperties (result, inspectView) { 42 | return this.callOnActivePlugin('didRequestProperties', [ 43 | result, 44 | inspectView]); 45 | } 46 | 47 | public requestScopeProperties (result, inspectView) { 48 | return this.callOnActivePlugin('didRequestScopeProperties', [ 49 | result, 50 | inspectView]); 51 | } 52 | 53 | public evaluateExpression (expression: string, range) { 54 | return this.callOnActivePlugin('didEvaluateExpression', [ 55 | expression, 56 | range]); 57 | } 58 | 59 | public addBreakpoint (filePath: string, fileNumber: number, condition?: string) { 60 | return this.callOnActivePlugin('didAddBreakpoint', [ 61 | filePath, 62 | fileNumber, 63 | condition]); 64 | } 65 | 66 | public changeBreakpoint (filePath: string, fileNumber: number, condition?: string) { 67 | return this.callOnActivePlugin('didChangeBreakpoint', [ 68 | filePath, 69 | fileNumber, 70 | condition]); 71 | } 72 | 73 | public removeBreakpoint (filePath: string, fileNumber: number, condition?: string) { 74 | return this.callOnActivePlugin('didRemoveBreakpoint', [ 75 | filePath, 76 | fileNumber, 77 | condition]); 78 | } 79 | 80 | public run () { 81 | return this.callOnActivePlugin('didRun'); 82 | } 83 | 84 | public stop () { 85 | return this.callOnActivePlugin('didStop'); 86 | } 87 | 88 | public pause () { 89 | return this.callOnActivePlugin('didPause'); 90 | } 91 | 92 | public resume () { 93 | return this.callOnActivePlugin('didResume'); 94 | } 95 | 96 | public stepOver () { 97 | return this.callOnActivePlugin('didStepOver'); 98 | } 99 | 100 | public stepInto () { 101 | return this.callOnActivePlugin('didStepInto'); 102 | } 103 | 104 | public stepOut () { 105 | return this.callOnActivePlugin('didStepOut'); 106 | } 107 | 108 | getPlugins () { 109 | return this.plugins; 110 | } 111 | 112 | addPlugin (plugin: Plugin) { 113 | this.plugins.push(plugin); 114 | this.events.emit('addPlugin', plugin); 115 | } 116 | 117 | getPluginFromName (pluginName: string) { 118 | return this.plugins.find((p) => { 119 | return (p.name === pluginName) 120 | }) 121 | } 122 | 123 | removePlugin (plugin: Plugin) { 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/plugin/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './PluginClient' 9 | export * from './PluginManager' 10 | -------------------------------------------------------------------------------- /src/storage.ts: -------------------------------------------------------------------------------- 1 | 'use babel' 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { mkdir, stat, writeFile, readFile } from 'fs'; 9 | import { join } from 'path'; 10 | 11 | export class Storage { 12 | 13 | storagePath: string = join(atom['configDirPath'], 'storage', 'xatom-debug') 14 | filePath: string; 15 | 16 | constructor () { 17 | // create path if does not exists 18 | this.isPathPresent().then((exists) => { 19 | if (exists === false) { 20 | this.createPath(); 21 | } 22 | }); 23 | } 24 | 25 | setPath (configFile: string) { 26 | let token = btoa(configFile); 27 | this.filePath = join(this.storagePath, `${token}.json`) as string; 28 | } 29 | 30 | isPathPresent () { 31 | return new Promise((resolve, reject) => { 32 | stat(this.storagePath, (err, stats) => { 33 | if (err) { 34 | resolve(false); 35 | } else { 36 | resolve(stats); 37 | } 38 | }) 39 | }) 40 | } 41 | 42 | createPath () { 43 | return new Promise((resolve, reject) => { 44 | mkdir(this.storagePath, (err) => { 45 | if (err) { 46 | reject(err); 47 | } else { 48 | resolve(); 49 | } 50 | }) 51 | }) 52 | } 53 | 54 | save (content: string) { 55 | return new Promise((resolve, reject) => { 56 | writeFile(this.filePath, content, (err) => { 57 | if (err) { 58 | reject(err); 59 | } else { 60 | resolve(); 61 | } 62 | }); 63 | }) 64 | } 65 | 66 | read () { 67 | return new Promise ((resolve, reject) => { 68 | readFile(this.filePath, (err, data) => { 69 | if (err) { 70 | reject(err); 71 | } 72 | try { 73 | resolve(JSON.parse(String(data))) 74 | } catch (e) { 75 | reject(e) 76 | } 77 | }) 78 | }) 79 | } 80 | 81 | async saveObjectFromKey (key, object) { 82 | let content = await this.read().catch(() => { 83 | // no contents 84 | }); 85 | if (!content) { 86 | content = {} 87 | } 88 | content[key] = object; 89 | return await this.save(JSON.stringify(content)); 90 | } 91 | 92 | async saveFromObject (content: any) { 93 | return await this.save(JSON.stringify(content)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | import { Greet } from './greet'; 2 | import { Person } from './person'; 3 | 4 | var person2: Person = { 5 | name: 'Lavinia Dinu', 6 | age: 25, 7 | active: true, 8 | dateOfBirth: new Date(1992, 2, 25) 9 | } 10 | 11 | var person1: Person = { 12 | name: 'Williams Medina', 13 | age: 28, 14 | active: true, 15 | dateOfBirth: new Date(1989, 0, 28) 16 | }; 17 | 18 | // Greet 19 | console.log(person1) 20 | console.log(Greet(person1)) 21 | console.log(Greet(person2)) 22 | -------------------------------------------------------------------------------- /src2/Expression.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/src2/Expression.ts -------------------------------------------------------------------------------- /src2/GroupView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | const { CompositeDisposable, Emitter, Disposable } = require('atom'); 8 | import { get, forEach, isEqual } from 'lodash'; 9 | import { View, ViewElement, Element } from './View'; 10 | import { CallFrame } from './debug'; 11 | 12 | export interface GroupViewOptions { 13 | title: string; 14 | selectable?: boolean; 15 | actions?: any; 16 | } 17 | 18 | @View({ 19 | name: 'xatom-group', 20 | template: `
21 |
` 22 | }) 23 | export class GroupView { 24 | public element: HTMLElement; 25 | private groupItems: any[] = []; 26 | private emitter = new Emitter(); 27 | @Element('.xatom-group-body') contentElement: HTMLButtonElement; 28 | @Element('.xatom-group-header') headerElement: HTMLElement; 29 | constructor ( 30 | private viewElement: ViewElement, 31 | private options: GroupViewOptions) { 32 | this.element = this.getElement(); 33 | } 34 | removeItems () { 35 | if (this.contentElement){ 36 | this.contentElement.innerHTML = ''; 37 | } 38 | } 39 | getItem (data: any) { 40 | return this.groupItems.find((groupItem) => { 41 | return isEqual(groupItem.data, data); 42 | }); 43 | } 44 | removeItem (data: any) { 45 | const groupItem = this.getItem(data); 46 | if (groupItem) { 47 | groupItem.item.remove(); 48 | const index = this.groupItems.indexOf(groupItem); 49 | this.groupItems.splice(index, 1); 50 | } 51 | } 52 | activate (item) { 53 | this.groupItems.forEach((groupItem) => { 54 | if (groupItem === item) { 55 | groupItem.item.classList.add('active'); 56 | this.emitter.emit('didSelect', groupItem); 57 | } else { 58 | groupItem.item.classList.remove('active'); 59 | } 60 | }); 61 | } 62 | onDidSelect (cb: Function) { 63 | return this.emitter.on('didSelect', cb); 64 | } 65 | addItem (item: HTMLElement, data: any) { 66 | const groupItem = { 67 | item, 68 | data 69 | } 70 | this.groupItems.push(groupItem); 71 | if (this.options.selectable) { 72 | item.addEventListener('click', () => this.activate(groupItem)); 73 | } 74 | this.contentElement.appendChild(groupItem.item); 75 | return groupItem; 76 | } 77 | viewDidLoad () { 78 | // 79 | this.headerElement.innerHTML = ` ${this.options.title} `; 80 | forEach(get(this, 'options.actions', []), (value, key) => { 81 | const button = document.createElement('button'); 82 | button.innerText = key.toString(); 83 | button.classList.add('btn'); 84 | button.addEventListener('click', () => value()); 85 | this.headerElement.appendChild(button); 86 | }) 87 | } 88 | getElement () { 89 | return this.viewElement.element; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src2/Location.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const { CompositeDisposable, Range, Emitter, Disposable } = require('atom'); 9 | import { Breakpoint } from './breakpoint'; 10 | import { get } from 'lodash'; 11 | 12 | export class Location { 13 | private lineMarker: any; 14 | private lineNumberMarker: any; 15 | private lineDecorator: any; 16 | private lineNumberDecorator: any; 17 | private className: string; 18 | private editor: any; 19 | constructor (private location: Breakpoint, type?: string) { 20 | this.openEditor(location); 21 | this.setClassName(type); 22 | } 23 | setClassName (type: string) { 24 | let typeClass = ''; 25 | if (type) { 26 | typeClass = `xatom-debug-location-${type}`; 27 | } 28 | this.className = `xatom-debug-location ${typeClass}`; 29 | } 30 | async markLocation (location: Breakpoint) { 31 | if (this.lineDecorator) this.lineDecorator.destroy(); 32 | if (this.lineNumberDecorator) this.lineNumberDecorator.destroy(); 33 | if (this.lineMarker) this.lineMarker.destroy(); 34 | if (this.lineNumberMarker) this.lineNumberMarker.destroy(); 35 | const range = new Range( 36 | [location.lineNumber, location.columnNumber], 37 | [location.lineNumber, location.columnNumber]); 38 | this.lineMarker = this.editor.markBufferRange(range); 39 | this.lineNumberMarker = this.editor.markBufferRange(range); 40 | this.lineDecorator = this.editor.decorateMarker(this.lineMarker, { 41 | type: 'line', 42 | class: this.className 43 | }); 44 | this.lineNumberDecorator = this.editor.decorateMarker(this.lineNumberMarker, { 45 | type: 'line-number', 46 | class: this.className 47 | }); 48 | atom.focus(); 49 | } 50 | updateDecorators () { 51 | this.lineDecorator.setProperties({ 52 | type: 'line', 53 | class: this.className 54 | }); 55 | this.lineNumberDecorator.setProperties({ 56 | type: 'line-number', 57 | class: this.className 58 | }); 59 | } 60 | async openEditor (location: Breakpoint) { 61 | const lineRange = new Range([location.lineNumber, 0], 62 | [location.lineNumber, 0]); 63 | this.editor = await atom.workspace.open(location.filePath, { 64 | initialLine: location.lineNumber || 0, 65 | initialColumn: location.columnNumber || 0 66 | }); 67 | this.editor 68 | .getGutters() 69 | .filter((gutter) => gutter.name !== 'line-number') 70 | .forEach((gutter) => { 71 | gutter.hide(); 72 | }); 73 | const decorator = this.editor 74 | .getLineNumberDecorations({ 75 | class: 'xatom-breakpoint' 76 | }) 77 | .find((d) => { 78 | return lineRange.isEqual(d.getMarker().getBufferRange()); 79 | }); 80 | if (decorator) { 81 | this.setClassName('breakpoint'); 82 | } 83 | this.markLocation(location); 84 | this.editor.onDidAddDecoration((decoration) => { 85 | const className = get(decoration, 'properties.class'); 86 | const isBreakpoint = className === 'xatom-breakpoint'; 87 | if (isBreakpoint && lineRange.isEqual(decoration.getMarker().getBufferRange())) { 88 | this.setClassName('breakpoint'); 89 | this.updateDecorators(); 90 | } 91 | }); 92 | } 93 | destroy () { 94 | if (this.editor) { 95 | this 96 | .editor 97 | .getGutters() 98 | .filter((gutter) => gutter.name !== 'line-number') 99 | .forEach((gutter) => gutter.show()); 100 | } 101 | if (this.lineDecorator) this.lineDecorator.destroy(); 102 | if (this.lineNumberDecorator) this.lineNumberDecorator.destroy(); 103 | if (this.lineMarker) this.lineMarker.destroy(); 104 | if (this.lineNumberMarker) this.lineNumberMarker.destroy(); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src2/Package.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export class XAtomDebugPackage { 9 | private xAtomDebug: any; 10 | activate (): void { 11 | const { XAtomDebug } = require('./XAtomDebug'); 12 | this.xAtomDebug = new XAtomDebug(); 13 | } 14 | deactivate (): void { 15 | if (this.xAtomDebug) { 16 | this.xAtomDebug.destroy(); 17 | } 18 | } 19 | providePlugin () { 20 | return this.xAtomDebug.getProvider(); 21 | } 22 | deserializeBreakpointNavigatorView (serialized) { 23 | const { BreakpointNavigatorView } = require('./Breakpoint'); 24 | return new BreakpointNavigatorView(null); 25 | } 26 | } 27 | module.exports = new XAtomDebugPackage(); 28 | -------------------------------------------------------------------------------- /src2/Project.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const { Emitter } = require('atom'); 9 | import { Item } from './Storage'; 10 | 11 | export interface Project extends Item { 12 | projectPath: string 13 | } 14 | 15 | export class ProjectManager { 16 | private project: Project; 17 | private emitter = new Emitter(); 18 | constructor () { 19 | 20 | } 21 | setActive (project: Project) { 22 | this.project = project; 23 | this.emitter.emit('didChange', project); 24 | } 25 | onDidChange (cb) { 26 | return this.emitter.on('didChange', cb); 27 | } 28 | getActive () { 29 | return this.project; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src2/SchemeEditorView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { View, ViewElement } from './View'; 9 | 10 | export const SCHEME_EDITOR_URI = 'xatom://scheme-editor'; 11 | 12 | @View({ 13 | name: 'xatom-scheme-editor', 14 | template: `

Scheme Editor

` 15 | }) 16 | export class SchemeEditorView { 17 | constructor (private viewElement: ViewElement) { } 18 | setPlugins (plugins: any[]) { 19 | console.log('add plugins', plugins); 20 | } 21 | getElement () { 22 | return this.viewElement.element; 23 | } 24 | getTitle () { 25 | return 'Scheme Editor'; 26 | } 27 | getURI () { 28 | return SCHEME_EDITOR_URI; 29 | } 30 | getPreferredLocation () { 31 | return 'center'; 32 | } 33 | getAllowedLocations () { 34 | return ['center']; 35 | } 36 | destroy () { 37 | atom.workspace.hide(SCHEME_EDITOR_URI); 38 | this.viewElement.element.remove(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src2/ToolbarView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const { CompositeDisposable, Emitter, Disposable } = require('atom'); 9 | import { View, ViewElement, Element, Action } from './View'; 10 | import { SCHEME_EDITOR_URI } from './SchemeEditorView'; 11 | 12 | import { parse } from 'path'; 13 | 14 | @View({ 15 | name: 'xatom-debug-toolbar', 16 | template: `
17 |
18 | 21 |
22 |
23 | 26 |
27 |
28 | 32 | 33 |
34 |
35 | 39 |
40 |
` 41 | }) 42 | export class ToolbarView { 43 | public emitter = new Emitter(); 44 | private panel: any; 45 | constructor (private viewElement: ViewElement) { 46 | this.panel = atom.workspace.addHeaderPanel({ 47 | item: this.getElement(), 48 | visible: true 49 | }); 50 | } 51 | @Element('.xatom-debug-run') runElement: HTMLButtonElement; 52 | @Element('.xatom-debug-stop') stopElement: HTMLButtonElement; 53 | @Element('.xatom-debug-project') projectElement: HTMLSelectElement; 54 | @Element('.xatom-debug-scheme') schemeElement: HTMLButtonElement; 55 | @Element('.xatom-debug-status') statusElement: HTMLElement; 56 | // @ElementAction('change', function changeProject () { 57 | // const selectedProject = this.projectElement['value']; 58 | // console.log('selectedProject', selectedProject) 59 | // }) 60 | @Action('click', '.xatom-debug-run') clickRun () { 61 | this.emitter.emit('didClickRun'); 62 | } 63 | @Action('click', '.xatom-debug-stop') clickStop () { 64 | this.emitter.emit('didClickStop'); 65 | } 66 | @Action('click', '.xatom-debug-scheme') clickScheme () { 67 | atom.workspace.toggle(SCHEME_EDITOR_URI); 68 | } 69 | @Action('change', '.xatom-debug-project') changeProject () { 70 | const selectedProject = this.projectElement['value']; 71 | this.emitter.emit('didSelectProject', selectedProject); 72 | } 73 | setProjects (projects: any[]) { 74 | this.projectElement.innerHTML = ''; 75 | projects.forEach((directory, index) => { 76 | const option = document.createElement('option'); 77 | const name = parse(directory.path).base; 78 | option.value = directory.path; 79 | option.innerText = name; 80 | if (index === 0) { 81 | this.emitter.emit('didSelectProject', directory.path); 82 | } 83 | this.projectElement.appendChild(option); 84 | }); 85 | } 86 | onDidRun (callback: Function) { 87 | return this.emitter.on('didClickRun', callback); 88 | } 89 | onDidStop (callback: Function) { 90 | return this.emitter.on('didClickStop', callback); 91 | } 92 | onDidSelectProject (callback: Function) { 93 | return this.emitter.on('didSelectProject', callback); 94 | } 95 | disableControls () { 96 | this.projectElement.disabled = true; 97 | this.runElement.disabled = true; 98 | this.schemeElement.disabled = true; 99 | ( this.projectElement.parentNode).disabled = true; 100 | this.stopElement.disabled = false; 101 | } 102 | enableControls () { 103 | this.projectElement.disabled = false; 104 | this.runElement.disabled = false; 105 | this.schemeElement.disabled = false; 106 | ( this.projectElement.parentNode).disabled = false; 107 | this.stopElement.disabled = true; 108 | } 109 | setStatusLoading (value: boolean) { 110 | this.statusElement.classList[value ? 'add' : 'remove']('loading'); 111 | } 112 | setStatusState (type: string) { 113 | const iconElement = this.statusElement.querySelector('.xatom-icon'); 114 | iconElement.setAttribute('name', type); 115 | } 116 | setStatusText (text: string) { 117 | const textElement = this.statusElement.querySelector('.xatom-debug-status-text'); 118 | this.statusElement.style.display = 'block'; 119 | textElement.textContent = text; 120 | } 121 | getElement (): HTMLElement { 122 | return this.viewElement.element; 123 | } 124 | viewDidLoad () { 125 | this.setProjects(atom.project.getDirectories()); 126 | } 127 | toggle () { 128 | if (this.panel.visible) { 129 | this.panel.hide(); 130 | } else { 131 | this.panel.show(); 132 | } 133 | } 134 | destroy () { 135 | this.viewElement.element.remove(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src2/View.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { EventEmitter } from 'events'; 8 | import 'reflect-metadata'; 9 | 10 | // const viewControllerRegistry = new EventEmitter(); 11 | const viewRegistry = []; 12 | // viewControllerRegistry.setMaxListeners(0); 13 | // 14 | // 15 | // function getViewController (target: any): Promise<{ 16 | // viewController: ViewController, 17 | // complete: Function 18 | // }> { 19 | // return new Promise ((resolve, reject) => { 20 | // viewControllerRegistry.on('viewControllerLoad', function eventListener (controller: ViewController) { 21 | // if (Object.getPrototypeOf(controller.controller) === target) { 22 | // const task = new Promise((taskResolve, taskReject) => { 23 | // resolve({ 24 | // viewController: controller, 25 | // complete: taskResolve 26 | // }); 27 | // }); 28 | // console.log('register'); 29 | // controller.tasks.push(task); 30 | // viewControllerRegistry.removeListener('viewControllerLoad', eventListener); 31 | // } 32 | // }) 33 | // }) 34 | // } 35 | 36 | function getHTMLElement (controller: ViewController, query: string): Promise { 37 | return new Promise ((resolve, reject) => { 38 | const el = controller.viewElement.element.querySelector(query); 39 | if (el) { 40 | resolve( el); 41 | } else { 42 | reject(`element '${query}' does not exists`); 43 | } 44 | }) 45 | } 46 | 47 | 48 | export function Action (eventName: string, query: string) { 49 | return function (target, key, descriptor) { 50 | viewRegistry.push({ 51 | target, 52 | async create (viewController: ViewController, instance: any) { 53 | const el = await getHTMLElement(viewController, query); 54 | el.addEventListener(eventName, (event) => { 55 | if (instance[key]) { 56 | instance[key](event); 57 | } 58 | }); 59 | } 60 | }); 61 | return descriptor; 62 | } 63 | } 64 | 65 | export function Element (query: string) { 66 | return function (target, key, descriptor) { 67 | viewRegistry.push({ 68 | target, 69 | async create (viewController: ViewController, instance: any) { 70 | const el = await getHTMLElement(viewController, query); 71 | instance[key] = el; 72 | } 73 | }); 74 | return descriptor; 75 | } 76 | } 77 | 78 | export class ViewElement { 79 | public element: HTMLElement; 80 | constructor (elementName: string, template?: string) { 81 | this.element = document.createElement(elementName); 82 | this.element.innerHTML = template || ''; 83 | } 84 | } 85 | 86 | export class ViewController { 87 | public controller: any; 88 | constructor (public viewElement: ViewElement) { 89 | // do something 90 | } 91 | } 92 | 93 | export function View (options: { name: string, template?: string }) { 94 | return function createView (target: any, key: string, descriptor: Object) { 95 | const instance: any = function () { 96 | const paramTypes = Reflect.getMetadata('design:paramtypes', target, key); 97 | const viewElement = new ViewElement(options.name, options.template); 98 | const viewController = new ViewController(viewElement); 99 | const paramValues = paramTypes.map((param, index) => { 100 | if (param === ViewElement) return viewElement; 101 | if (param === ViewController) return viewController; 102 | return arguments[index]; 103 | }); 104 | target.apply(this, paramValues); 105 | const load = viewRegistry 106 | .filter(({target}) => { 107 | return Object.getPrototypeOf(this) === target; 108 | }) 109 | .map(({create}) => { 110 | return create(viewController, this); 111 | }) 112 | .reduce((r, p) => p.then(r), Promise.resolve()) 113 | .then(() => { 114 | if (this.viewDidLoad) { 115 | this.viewDidLoad(); 116 | } 117 | }); 118 | }; 119 | instance.prototype = target.prototype; 120 | return instance; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src2/XAtom.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { BreakpointManager } from './breakpoint'; 9 | import { ProjectManager } from './Project'; 10 | 11 | export namespace XAtom { 12 | export const breakpoints = new BreakpointManager(); 13 | export const project = new ProjectManager(); 14 | } 15 | -------------------------------------------------------------------------------- /src2/XAtomDebug.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | const { CompositeDisposable, Disposable } = require('atom'); 8 | import { XAtom } from './XAtom'; 9 | import { Project } from './Project'; 10 | 11 | import { ToolbarView } from './ToolbarView'; 12 | import { 13 | DebugControlView, 14 | DebugAreaView, 15 | DebugNavigatorView, 16 | DEBUG_NAVIGATOR_URI, 17 | DEBUG_AREA_URI 18 | } from './debug'; 19 | import { Breakpoint, BreakpointManager, BreakpointNavigatorView, BREAKPOINT_NAVIGATOR_URI } from './breakpoint'; 20 | import { SchemeEditorView, SCHEME_EDITOR_URI } from './SchemeEditorView'; 21 | import { PluginManager, PluginSession } from './plugin'; 22 | import { Storage } from './storage'; 23 | 24 | export class XAtomDebug { 25 | private pluginManager: PluginManager; 26 | // static views 27 | private toolbarView = new ToolbarView(null); 28 | private debugControlView = new DebugControlView(null); 29 | // dynamic views 30 | private schemeEditorView = new SchemeEditorView(null); 31 | private debugAreaView = new DebugAreaView(null); 32 | private debugNavigatorView = new DebugNavigatorView(null); 33 | 34 | private subscriptions: any; 35 | constructor () { 36 | // managers 37 | this.pluginManager = new PluginManager( 38 | this.toolbarView, 39 | this.debugControlView, 40 | this.debugAreaView, 41 | this.debugNavigatorView 42 | ); 43 | // subscriptions 44 | this.subscriptions = new CompositeDisposable( 45 | // Set projects 46 | atom.project.onDidChangePaths(() => { 47 | this.toolbarView.setProjects(atom.project.getDirectories()); 48 | }), 49 | // Set Plugins 50 | this.pluginManager.onDidChangePlugins((plugins) => { 51 | this.schemeEditorView.setPlugins(plugins); 52 | }), 53 | // Listen Toolbar events 54 | this.toolbarView.onDidRun(() => this.pluginManager.execute('run')), 55 | this.toolbarView.onDidStop(() => this.pluginManager.execute('stop')), 56 | this.toolbarView.onDidSelectProject(async (projectPath) => { 57 | let project = await Storage.project.findOne({ projectPath }); 58 | if (!project) { 59 | project = await Storage.project.insert( { projectPath }); 60 | } 61 | XAtom.project.setActive( project); 62 | }), 63 | XAtom.project.onDidChange(() => XAtom.breakpoints.restore()), 64 | // Listen Debug Navigator events 65 | this.debugControlView.onDidContinue(() => this.pluginManager.execute('continue')), 66 | this.debugControlView.onDidPause(() => this.pluginManager.execute('pause')), 67 | this.debugControlView.onDidStepOver(() => this.pluginManager.execute('stepOver')), 68 | this.debugControlView.onDidStepInto(() => this.pluginManager.execute('stepInto')), 69 | this.debugControlView.onDidStepOut(() => this.pluginManager.execute('stepOut')), 70 | this.debugAreaView.onDidExitProcess(() => this.pluginManager.getSession().end()), 71 | // Observe text editors ::observeActiveTextEditor 72 | atom.workspace.getCenter().observeActivePaneItem((item) => { 73 | if (!atom.workspace.isTextEditor(item)) return; 74 | XAtom.breakpoints.attachEditor(item); 75 | }), 76 | // Listean Breakpoints 77 | XAtom.breakpoints.onDidAdd((b: Breakpoint) => { 78 | this.pluginManager.execute('addBreakpoint', [b]); 79 | }), 80 | XAtom.breakpoints.onDidRemove((b: Breakpoint) => { 81 | this.pluginManager.execute('removeBreakpoint', [b]); 82 | }), 83 | // Register panel toggle views 84 | atom.workspace.addOpener((uri) => { 85 | if (uri === DEBUG_NAVIGATOR_URI) return this.debugNavigatorView; 86 | if (uri === DEBUG_AREA_URI) return this.debugAreaView; 87 | if (uri === SCHEME_EDITOR_URI) return this.schemeEditorView; 88 | if (uri === BREAKPOINT_NAVIGATOR_URI) return new BreakpointNavigatorView(null); 89 | }), 90 | // Destroy panel views when package is deactivated 91 | new Disposable(() => { 92 | atom.workspace.getPaneItems().forEach((item) => { 93 | if (item instanceof DebugNavigatorView || 94 | item instanceof DebugAreaView || 95 | item instanceof SchemeEditorView || 96 | item instanceof BreakpointNavigatorView) { 97 | item.destroy(); 98 | } 99 | }); 100 | }), 101 | // Commands 102 | atom.commands.add('atom-workspace', { 103 | 'XAtom: Toggle Debugger': () => { 104 | this.toolbarView.toggle(); 105 | }, 106 | 'XAtom: Open Breakpoint Navigator': () => { 107 | atom.workspace.open(BREAKPOINT_NAVIGATOR_URI, {}); 108 | } 109 | }) 110 | ); 111 | } 112 | bind (object: any, functionName: string): Function { 113 | return object[functionName].bind(object); 114 | } 115 | getProvider () { 116 | return { 117 | addPlugin: this.bind(this.pluginManager, 'addPlugin'), 118 | removePlugin: this.bind(this.pluginManager, 'removePlugin'), 119 | getSession: this.bind(this.pluginManager, 'getSession'), 120 | getLauncher: () => { 121 | return { 122 | start: this.bind(this.debugAreaView, 'startProcess') 123 | } 124 | } 125 | }; 126 | } 127 | destroy (): void { 128 | XAtom.breakpoints.destroy(); 129 | this.subscriptions.dispose(); 130 | this.toolbarView.destroy(); 131 | this.pluginManager.destroy(); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src2/breakpoint/Breakpoint.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { Item } from '../storage'; 9 | 10 | export interface Breakpoint extends Item { 11 | lineNumber: number, 12 | columnNumber: number, 13 | filePath: string, 14 | condition: string, 15 | marker?: any 16 | } 17 | export type Breakpoints = Array; 18 | -------------------------------------------------------------------------------- /src2/breakpoint/BreakpointNavigatorView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const { CompositeDisposable, Disposable } = require('atom'); 9 | import { XAtom } from '../XAtom'; 10 | import { View, ViewElement } from '../View'; 11 | import { Project } from '../Project'; 12 | import { GroupView } from '../GroupView'; 13 | import { Breakpoint } from './Breakpoint'; 14 | import { BreakpointView } from './BreakpointView'; 15 | 16 | export const BREAKPOINT_NAVIGATOR_URI = 'xatom://breakpoint-navigator'; 17 | 18 | @View({ 19 | name: 'xatom-breakpoint-navigator' 20 | }) 21 | export class BreakpointNavigatorView { 22 | public element: HTMLElement; 23 | private subscriptions: any; 24 | private breakpointGroupView: GroupView; 25 | constructor (private viewElement: ViewElement) { 26 | this.breakpointGroupView = new GroupView(null, { 27 | title: ' ', 28 | actions: { 29 | 'Remove All': () => this.removeAll() 30 | } 31 | }); 32 | this.element = this.getElement(); 33 | this.element.appendChild(this.breakpointGroupView.getElement()); 34 | this.setCurrentBreakpoints(); 35 | this.subscriptions = new CompositeDisposable( 36 | XAtom.project.onDidChange(() => this.setCurrentBreakpoints()), 37 | XAtom.breakpoints.onDidAdd((b: Breakpoint) => this.addBreakpoint(b)), 38 | XAtom.breakpoints.onDidRemove((b: Breakpoint) => this.removeBreakpoint(b)) 39 | ); 40 | } 41 | addBreakpoint (breakpoint: Breakpoint) { 42 | const item = new BreakpointView(null, breakpoint); 43 | this.breakpointGroupView.addItem(item.getElement(), { 44 | filePath: breakpoint.filePath, 45 | lineNumber: breakpoint.lineNumber 46 | }); 47 | } 48 | removeBreakpoint (breakpoint: Breakpoint) { 49 | this.breakpointGroupView.removeItem({ 50 | filePath: breakpoint.filePath, 51 | lineNumber: breakpoint.lineNumber 52 | }); 53 | } 54 | async removeAll () { 55 | const breakpoints = await XAtom.breakpoints.get(); 56 | breakpoints.forEach((b) => XAtom.breakpoints.remove(b.filePath, b.lineNumber)); 57 | } 58 | async setCurrentBreakpoints () { 59 | this.breakpointGroupView.removeItems(); 60 | const breakpoints = await XAtom.breakpoints.get(); 61 | breakpoints.forEach((b) => this.addBreakpoint(b)); 62 | } 63 | getElement () { 64 | return this.viewElement.element; 65 | } 66 | getTitle () { 67 | return 'Breakpoints'; 68 | } 69 | getURI () { 70 | return BREAKPOINT_NAVIGATOR_URI; 71 | } 72 | serialize() { 73 | return { 74 | deserializer: 'XAtom/BreakpointNavigatorView' 75 | }; 76 | } 77 | getDefaultLocation () { 78 | return 'right'; 79 | } 80 | getAllowedLocations () { 81 | return ['right', 'center', 'left']; 82 | } 83 | destroy () { 84 | atom.workspace.hide(BREAKPOINT_NAVIGATOR_URI); 85 | this.viewElement.element.remove(); 86 | this.subscriptions.dispose(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src2/breakpoint/BreakpointView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { XAtom } from '../XAtom'; 9 | import { View, ViewElement, Action, Element } from '../View'; 10 | import { Breakpoint } from './Breakpoint'; 11 | import { stat } from 'fs'; 12 | import { join } from 'path'; 13 | 14 | @View({ 15 | name: 'xatom-debug-breakpoint', 16 | template: `
17 |
18 | 19 |
20 |
` 21 | }) 22 | export class BreakpointView { 23 | public element: HTMLElement; 24 | @Element('.xatom-debug-breakpoint') itemElement: HTMLButtonElement; 25 | @Action('click', '.xatom-debug-breakpoint') openBreakpoint () { 26 | atom.workspace.open(this.data.filePath, { 27 | initialLine: this.data.lineNumber || 0, 28 | initialColumn: this.data.columnNumber || 0 29 | }); 30 | } 31 | constructor ( 32 | private viewElement: ViewElement, 33 | private data: Breakpoint) { 34 | this.element = this.getElement(); 35 | } 36 | viewDidLoad () { 37 | const project = XAtom.project.getActive(); 38 | const filePath = this.data.filePath.replace(join(project.projectPath, '/'), ''); 39 | this.itemElement.innerHTML = `${filePath} 40 | ${this.data.lineNumber + 1}:${this.data.columnNumber}`; 41 | this.itemElement.setAttribute('data-name', this.data.filePath); 42 | } 43 | getElement () { 44 | return this.viewElement.element; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src2/breakpoint/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './Breakpoint'; 9 | export * from './BreakpointManager'; 10 | export * from './BreakpointNavigatorView'; 11 | -------------------------------------------------------------------------------- /src2/debug/CallFrame.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export interface CallFrame { 9 | filePath: string; 10 | functionName: string; 11 | lineNumber: number; 12 | columnNumber: number; 13 | } 14 | 15 | export type CallFrames = Array; 16 | -------------------------------------------------------------------------------- /src2/debug/DebugAreaView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const { CompositeDisposable, Emitter, Disposable } = require('atom'); 9 | import { View, ViewElement } from '../View'; 10 | import ResizeObserver from 'resize-observer-polyfill'; 11 | import { spawn as spawnPty } from 'node-pty'; 12 | import Terminal from 'xterm'; 13 | 14 | const path = require('path'); 15 | Terminal.loadAddon('fit'); 16 | 17 | export const DEBUG_AREA_URI = 'xatom://debug-area'; 18 | 19 | @View({ 20 | name: 'xatom-debug-area' 21 | }) 22 | export class DebugAreaView { 23 | private resizeObserver: any; 24 | private resizeHandler: any; 25 | private terminal: any; 26 | private pty: any; 27 | public element: HTMLElement; 28 | public emitter = new Emitter(); 29 | constructor(private viewElement: ViewElement) { 30 | this.element = this.getElement(); 31 | } 32 | elementDidResize () { 33 | clearTimeout(this.resizeHandler); 34 | this.resizeHandler = setTimeout(() => { 35 | if (this.terminal) { 36 | this.terminal.fit(); 37 | if(this.pty) this.pty.resize(this.terminal.cols, this.terminal.rows); 38 | }; 39 | }, 250); 40 | } 41 | onDidExitProcess (cb) { 42 | return this.emitter.on('didExitProccess', cb); 43 | } 44 | showInitialMessage () { 45 | const date = new Date().toString(); 46 | this.terminal.writeln(`\x1b[1m\x1b[90mXAtom: Debugger v1.6.11\x1b[0m\x1b[0m`); 47 | this.terminal.writeln(`\x1b[1m\x1b[90m${date}\x1b[0m\x1b[0m`); 48 | } 49 | startProcess (command: string, args?: string[], options?: any) { 50 | const projectPaths = atom.project.getPaths(); 51 | const defaultOptions = { 52 | name: 'xterm-color', 53 | cwd: path.resolve(process.env.HOME), 54 | env: Object.assign({}, process.env, { 55 | TERM: 'xterm-256color', 56 | CLICOLOR: '1', 57 | LSCOLORS: 'ExFxCxDxBxegedabagacad' 58 | }) 59 | }; 60 | this.pty = spawnPty(command, 61 | args || [], 62 | Object.assign(defaultOptions, options)); 63 | this.terminal = new Terminal(); 64 | this.terminal.open(this.getElement(), true); 65 | this.terminal.on('data', (data) => { 66 | return this.pty.write(data); 67 | }); 68 | this.showInitialMessage(); 69 | 70 | this.element.addEventListener('focus', () => this.terminal.focus()); 71 | this.resizeObserver = new ResizeObserver(this.elementDidResize.bind(this)); 72 | this.resizeObserver.observe(this.element); 73 | 74 | this.pty.on('data', (data) => { 75 | return this.terminal.write(data); 76 | }); 77 | this.pty.on('exit', () => { 78 | this.emitter.emit('didExitProccess') 79 | this.destroy(); 80 | }); 81 | return this.pty; 82 | } 83 | destroy () { 84 | if (this.resizeObserver) this.resizeObserver.disconnect(); 85 | if (this.pty) this.pty.kill(); 86 | if (this.terminal) this.terminal.destroy(); 87 | this.pty = null; 88 | } 89 | clear () { 90 | this.terminal.clear(); 91 | } 92 | copySelection () { 93 | let selectedText = window.getSelection().toString(); 94 | let preparedText = this.formatText(selectedText); 95 | atom.clipboard.write(preparedText); 96 | } 97 | pasteFromClipboard () { 98 | let text = atom.clipboard.read(); 99 | this.pty.write(text); 100 | } 101 | formatText (text: string) { 102 | const space = String.fromCharCode(32); 103 | const nonBreakingSpace = String.fromCharCode(160); 104 | const allNonBreakingSpaces = new RegExp(nonBreakingSpace, 'g'); 105 | return text.split('\n').map((line) => { 106 | return line.replace(/\s+$/g, '').replace(allNonBreakingSpaces, space); 107 | }).join('\n'); 108 | } 109 | getDefaultLocation () { 110 | return 'bottom'; 111 | } 112 | getAllowedLocations () { 113 | return ['bottom', 'top', 'center']; 114 | } 115 | getElement () { 116 | return this.viewElement.element; 117 | } 118 | getURI () { 119 | return DEBUG_AREA_URI; 120 | } 121 | getIconName () { 122 | return 'debug-area'; 123 | } 124 | getTitle () { 125 | return 'Debug Area'; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src2/debug/DebugFrameView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { XAtom } from '../XAtom'; 9 | import { View, ViewElement, Action, Element } from '../View'; 10 | import { CallFrame } from './CallFrame'; 11 | import { stat } from 'fs'; 12 | import { join } from 'path'; 13 | 14 | @View({ 15 | name: 'xatom-debug-frame', 16 | template: `
` 17 | }) 18 | export class DebugFrameView { 19 | public element: HTMLElement; 20 | @Element('.xatom-group-item') itemElement: HTMLButtonElement; 21 | @Action('click', '.xatom-group-item') openFrame () { 22 | // open file 23 | atom.workspace.open(this.data.filePath, { 24 | initialLine: this.data.lineNumber || 0, 25 | initialColumn: this.data.columnNumber || 0 26 | }); 27 | } 28 | constructor ( 29 | private viewElement: ViewElement, 30 | private data: CallFrame) { 31 | this.element = this.getElement(); 32 | } 33 | async viewDidLoad () { 34 | // if (this.data) { 35 | // const fileExists = await new Promise((resolve) => { 36 | // stat(this.data.filePath, (err) => resolve(err ? false : true)); 37 | // }); 38 | // if (fileExists) { 39 | // // test 40 | // } 41 | // } 42 | const project = XAtom.project.getActive(); 43 | const filePath = this.data.filePath.replace(join(project.projectPath, '/'), ''); 44 | 45 | this.itemElement.innerHTML = ` 46 |
47 | ${this.data.functionName || 'anonymous'} 48 |
49 |
50 |
${filePath}
51 |
${this.data.lineNumber + 1}:${this.data.columnNumber}
52 |
`; 53 | // this.itemElement.setAttribute('data-name', filePath); 54 | } 55 | getElement () { 56 | return this.viewElement.element; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src2/debug/DebugNavigatorView.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { View, ViewElement } from '../View'; 9 | import { GroupView } from '../GroupView'; 10 | import { DebugFrameView } from './DebugFrameView'; 11 | import { CallFrames, CallFrame } from './CallFrame'; 12 | 13 | export const DEBUG_NAVIGATOR_URI = 'xatom://debug-navigator'; 14 | 15 | @View({ 16 | name: 'xatom-debug-navigator' 17 | }) 18 | export class DebugNavigatorView { 19 | public element: HTMLElement; 20 | public frameGroupView: GroupView; 21 | public watchGroupView: GroupView; 22 | public variableGroupView: GroupView; 23 | constructor (private viewElement: ViewElement) { 24 | this.element = this.getElement(); 25 | // Variables 26 | this.variableGroupView = new GroupView(null, { 27 | title: 'Variables' 28 | }); 29 | this.element.appendChild(this.variableGroupView.getElement()); 30 | // Watch 31 | this.watchGroupView = new GroupView(null, { 32 | title: 'Watch' 33 | }); 34 | this.element.appendChild(this.watchGroupView.getElement()); 35 | // Call Frames 36 | this.frameGroupView = new GroupView(null, { 37 | title: 'Call Frames', 38 | selectable: true 39 | }); 40 | this.element.appendChild(this.frameGroupView.getElement()); 41 | } 42 | // Variables 43 | addVariable (variable: any) { 44 | 45 | } 46 | setVariables (variables: any) { 47 | this.clearVariables(); 48 | variables.forEach((variable) => this.addVariable(variable)); 49 | } 50 | clearVariables () { 51 | this.variableGroupView.removeItems(); 52 | } 53 | // Watch 54 | addWatchVariable (expression: string) { 55 | // 56 | } 57 | // Frames 58 | addFrame (frame: CallFrame) { 59 | const item = new DebugFrameView(null, frame); 60 | return this.frameGroupView.addItem(item.getElement(), frame); 61 | } 62 | setFrames (frames: CallFrames) { 63 | this.clearFrames(); 64 | frames.forEach((frame, index) => { 65 | const groupItem = this.addFrame(frame); 66 | if (index === 0) { 67 | this.frameGroupView.activate(groupItem); 68 | } 69 | }); 70 | } 71 | clearFrames () { 72 | this.frameGroupView.removeItems(); 73 | } 74 | getElement () { 75 | return this.viewElement.element; 76 | } 77 | getTitle () { 78 | return 'Debug Navigator'; 79 | } 80 | getURI () { 81 | return DEBUG_NAVIGATOR_URI; 82 | } 83 | getDefaultLocation () { 84 | return 'right'; 85 | } 86 | getAllowedLocations () { 87 | return ['right', 'center', 'left']; 88 | } 89 | destroy () { 90 | atom.workspace.hide(DEBUG_NAVIGATOR_URI); 91 | this.viewElement.element.remove(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src2/debug/Variable.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export interface Variable { 9 | filePath: string; 10 | functionName: string; 11 | lineNumber: number; 12 | columnNumber: number; 13 | } 14 | 15 | export type Variables = Array; 16 | -------------------------------------------------------------------------------- /src2/debug/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './DebugAreaView'; 9 | export * from './DebugControlView'; 10 | export * from './DebugFrameView'; 11 | export * from './DebugNavigatorView'; 12 | export * from './CallFrame'; 13 | -------------------------------------------------------------------------------- /src2/plugin/Plugin.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | export interface Plugin { 8 | iconPath: string; 9 | } 10 | -------------------------------------------------------------------------------- /src2/plugin/PluginManager.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | const { CompositeDisposable, Range, Emitter, Disposable } = require('atom'); 8 | import { ToolbarView } from '../ToolbarView'; 9 | import { 10 | DebugControlView, 11 | DebugAreaView, 12 | DebugNavigatorView, 13 | DEBUG_AREA_URI, 14 | DEBUG_NAVIGATOR_URI 15 | } from '../debug'; 16 | import { PluginSession, createSession } from './PluginSession'; 17 | import { Plugin } from './Plugin'; 18 | 19 | export class PluginManager { 20 | private emitter = new Emitter(); 21 | private activePlugin: Plugin; 22 | public plugins: Array = []; 23 | constructor ( 24 | private toolbarView: ToolbarView, 25 | private debugControlView: DebugControlView, 26 | private debugAreaView: DebugAreaView, 27 | private debugNavigatorView: DebugNavigatorView) {} 28 | execute (functionName: string, functionArgs?: any[]) { 29 | const plugin = this.getActivePlugin(); 30 | if (plugin[functionName]) { 31 | plugin[functionName].apply(plugin, functionArgs); 32 | } 33 | } 34 | setActivePlugin (plugin: Plugin): void { 35 | this.activePlugin = plugin; 36 | } 37 | getSession (): PluginSession { 38 | return createSession( 39 | this.toolbarView, 40 | this.debugControlView, 41 | this.debugAreaView, 42 | this.debugNavigatorView 43 | ); 44 | } 45 | getActivePlugin (): Plugin { 46 | return this.activePlugin; 47 | } 48 | onDidChangePlugins (callback: Function) { 49 | return this.emitter.on('didChangePlugins', callback); 50 | } 51 | addPlugin (name: string, plugin: any) { 52 | const item = { 53 | name, 54 | plugin 55 | }; 56 | this.plugins.push(item); 57 | this.activePlugin = plugin; 58 | this.emitter.emit('didChangePlugins', this.plugins); 59 | } 60 | removePlugin (pluginName: string) { 61 | const index = this.plugins.findIndex((p) => p.name === pluginName); 62 | if (index > -1) this.plugins.splice(index, 1); 63 | this.emitter.emit('didChangePlugins', this.plugins); 64 | } 65 | destroy () { 66 | this.plugins = []; 67 | this.emitter.dispose(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src2/plugin/PluginSession.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | import { XAtom } from '../XAtom'; 8 | import { 9 | DebugControlView, 10 | DebugNavigatorView, 11 | DebugAreaView, 12 | CallFrames, 13 | DEBUG_NAVIGATOR_URI, 14 | DEBUG_AREA_URI 15 | } from '../debug'; 16 | import { Breakpoint, BREAKPOINT_NAVIGATOR_URI } from '../breakpoint'; 17 | import { Location } from '../Location'; 18 | 19 | export interface PluginSession { 20 | getControlOptions (): void; 21 | getSchemeOptions (): void; 22 | start (): void; 23 | end (): void; 24 | status (options: { 25 | text: string, 26 | type?: 'error' | 'warning' | 'success', 27 | loading: boolean 28 | }): void; 29 | } 30 | 31 | export function createSession ( 32 | toolbarView, 33 | debugControlView: DebugControlView, 34 | debugAreaView: DebugAreaView, 35 | debugNavigatorView: DebugNavigatorView) { 36 | let currentLocation; 37 | return { 38 | getControlOptions (): Promise { 39 | return new Promise((resolve, reject) => { 40 | resolve({ 41 | pauseOnException: debugControlView.isPauseOnExceptionEnabled(), 42 | disableBreakpoints: debugControlView.isBreakpointsDisabled() 43 | }); 44 | }); 45 | }, 46 | getSchemeOptions (): Promise { 47 | const editor = atom.workspace.getCenter().getActivePaneItem(); 48 | if (!atom.workspace.isTextEditor(editor)) return; 49 | return new Promise((resolve, reject) => { 50 | resolve({ 51 | currentPath: editor.getPath() 52 | }); 53 | }); 54 | }, 55 | getBreakpoints (): Promise { 56 | return XAtom.breakpoints.get(); 57 | }, 58 | async markLocation (location: Breakpoint, type?: string) { 59 | if (currentLocation) currentLocation.destroy(); 60 | 61 | return currentLocation = new Location(location, type); 62 | }, 63 | async markException (location: Breakpoint) { 64 | return this.markLocation(location, 'exception'); 65 | }, 66 | // async markBreakpoint (location: Breakpoint) { 67 | // return this.markLocation(location, 'breakpoint'); 68 | // }, 69 | setFrames (frames: CallFrames) { 70 | debugNavigatorView.setFrames(frames); 71 | }, 72 | status (o): void { 73 | toolbarView.setStatusText(o.text); 74 | toolbarView.setStatusLoading(o.loading || false); 75 | toolbarView.setStatusState(o.type || ''); 76 | }, 77 | pause () { 78 | debugControlView.enableControls(); 79 | }, 80 | resume () { 81 | debugControlView.disableControls(); 82 | }, 83 | start (): void { 84 | toolbarView.disableControls(); 85 | debugControlView.show(); 86 | atom.workspace.open(DEBUG_AREA_URI, {}); 87 | atom.workspace.open(BREAKPOINT_NAVIGATOR_URI, {}); 88 | atom.workspace.open(DEBUG_NAVIGATOR_URI, {}); 89 | }, 90 | end (): void { 91 | if (currentLocation) currentLocation.destroy(); 92 | toolbarView.enableControls(); 93 | debugControlView.hide(); 94 | atom.workspace.hide(DEBUG_AREA_URI); 95 | atom.workspace.hide(DEBUG_NAVIGATOR_URI); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src2/plugin/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './Plugin'; 9 | export * from './PluginManager'; 10 | export * from './PluginSession'; 11 | -------------------------------------------------------------------------------- /src2/storage/Collection.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | const path = require('path'); 9 | const Datastore = require('nedb'); 10 | const storagePath = path.resolve(atom['configDirPath'], 'storage', 'xatom'); 11 | 12 | export class Collection { 13 | private db; 14 | constructor (private filename: string) { 15 | this.db = new Datastore(path.join(storagePath), `${filename}.db`); 16 | } 17 | connect (): Promise { 18 | return new Promise((resolve, reject) => { 19 | return this.db.loadDatabase((err) => { 20 | if (err) { 21 | reject(); 22 | } else { 23 | resolve(this.db); 24 | } 25 | }) 26 | }); 27 | } 28 | insert (data: any) { 29 | return new Promise(async (resolve, reject) => { 30 | const db = await this.connect(); 31 | db.insert(data, (err, data) => { 32 | if (err) reject(err); 33 | resolve(data); 34 | }); 35 | }); 36 | } 37 | remove (data: any) { 38 | return new Promise(async (resolve, reject) => { 39 | const db = await this.connect(); 40 | db.remove(data, (err, data) => { 41 | if (err) reject(err); 42 | resolve(data); 43 | }); 44 | }); 45 | } 46 | findOne (options: any) { 47 | return new Promise(async (resolve, reject) => { 48 | const db = await this.connect(); 49 | db.findOne(options, (err, data) => { 50 | if (err) reject(err); 51 | resolve(data); 52 | }); 53 | }); 54 | } 55 | find (options: any): Promise { 56 | return new Promise(async (resolve, reject) => { 57 | const db = await this.connect(); 58 | db.find(options, (err, data) => { 59 | if (err) reject(err); 60 | resolve(data); 61 | }); 62 | }); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src2/storage/Item.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export interface Item { 9 | _id?: string; 10 | } 11 | -------------------------------------------------------------------------------- /src2/storage/Storage.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | import { Collection } from './Collection'; 9 | 10 | export namespace Storage { 11 | 12 | export const project = new Collection('projects'); 13 | export const breakpoint = new Collection('breakpoints'); 14 | export const expression = new Collection('expressions'); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src2/storage/index.ts: -------------------------------------------------------------------------------- 1 | 'use babel'; 2 | /*! 3 | * XAtom Debug 4 | * Copyright(c) 2017 Williams Medina 5 | * MIT Licensed 6 | */ 7 | 8 | export * from './Storage'; 9 | export * from './Collection'; 10 | export * from './Item'; 11 | -------------------------------------------------------------------------------- /styles/xatom-debug-breakpoint.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * XAtom Debug 3 | * Copyright(c) 2017 Williams Medina 4 | * MIT Licensed 5 | */ 6 | 7 | @import "ui-variables"; 8 | // 9 | // .xatom-breakpoint-line { 10 | // background-color: fadeOut(@background-color-info, 75%)!important; 11 | // box-shadow: 0 .05rem 0 0 fadeOut(@background-color-info, 30%) inset, 12 | // 0 .05rem 0 0 fadeOut(@background-color-info, 30%); 13 | // } 14 | // 15 | // .xatom-breakpoint-edit { 16 | // padding: 2px; 17 | // width: auto; 18 | // min-width: 340px; 19 | // background-color: @base-background-color; 20 | // border-radius: @component-border-radius; 21 | // border: 1px solid @button-border-color; 22 | // margin-top: -24px; 23 | // z-index: 1; 24 | // atom-text-editor { 25 | // margin-right: 36px; 26 | // border-top-right-radius: 0!important; 27 | // border-bottom-right-radius: 0!important; 28 | // } 29 | // button { 30 | // position: absolute; 31 | // top: 0; 32 | // right: 0; 33 | // width: 35px; 34 | // margin: 2px; 35 | // border-top-left-radius: 0; 36 | // border-bottom-left-radius: 0; 37 | // .xatom-icon { 38 | // height: 10px; 39 | // width: 8px; 40 | // } 41 | // } 42 | // xatom-breakpoint-edit-arrow { 43 | // position: absolute; 44 | // left: -10px; 45 | // top: 50%; 46 | // margin-top: -8px; 47 | // width: 10px; 48 | // overflow: hidden; 49 | // height: 16px; 50 | // &:before { 51 | // content: ''; 52 | // transform: rotate(45deg); 53 | // background-color: @base-background-color; 54 | // width: 14px; 55 | // height: 14px; 56 | // position: absolute; 57 | // top: 50%; 58 | // left: 4px; 59 | // margin-top: -7px; 60 | // border-radius: 0 0 0 @component-border-radius; 61 | // box-shadow: 0 0 0 .05rem @button-border-color inset 62 | // } 63 | // } 64 | // } 65 | 66 | // Breakpoint 67 | .xatom-breakpoint { 68 | z-index: 1; 69 | opacity: .5!important; 70 | &.xatom-debug-location-breakpoint { 71 | opacity: 1!important; 72 | color: white!important; 73 | } 74 | &:after { 75 | content: ''; 76 | background-color: @background-color-info; 77 | background-repeat: no-repeat; 78 | background-position: center left; 79 | background-size: 100% auto; 80 | -webkit-mask-image: url(atom://xatom-debug/icons/breakpoint.svg); 81 | -webkit-mask-repeat: no-repeat; 82 | -webkit-mask-position: top right; 83 | -webkit-mask-size: cover; 84 | position: absolute; 85 | height: 100%; 86 | top: 0; 87 | left: 0; 88 | right: 0.1em; 89 | z-index: -1; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /styles/xatom-debug-control.less: -------------------------------------------------------------------------------- 1 | @import "ui-variables"; 2 | 3 | xatom-debug-control { 4 | padding: 2px; 5 | display: block; 6 | .btn { 7 | padding: 1px 8px; 8 | background-color: transparent; 9 | border-color: transparent!important; 10 | box-shadow: none; 11 | i.xatom-icon { 12 | width: 18px; 13 | height: 22px; 14 | } 15 | } 16 | .checkbox { 17 | margin: 0; 18 | .checkbox-text { 19 | margin-left: 5px; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /styles/xatom-debug-frame.less: -------------------------------------------------------------------------------- 1 | @import "ui-variables"; 2 | 3 | xatom-debug-frame { 4 | display: block; 5 | .xatom-group-item { 6 | display: flex; 7 | flex-wrap: wrap; 8 | align-items: flex-start; 9 | justify-content: space-between; 10 | .xatom-debug-frame-name { 11 | display: flex; 12 | margin-right: 5px; 13 | } 14 | .xatom-debug-frame-location { 15 | display: flex; 16 | align-items: flex-end; 17 | .xatom-debug-frame-file { 18 | word-break: break-word; 19 | white-space: pre-wrap; 20 | opacity: .65; 21 | } 22 | .xatom-debug-frame-position { 23 | margin-left: 5px; 24 | padding: 0 5px; 25 | background-color: @text-color-subtle; 26 | border-radius: 3px; 27 | color: #fff; 28 | } 29 | } 30 | } 31 | &.active { 32 | background-color: @background-color-info; 33 | color: #fff; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /styles/xatom-debug-icons.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * XAtom Debug 3 | * Copyright(c) 2017 Williams Medina 4 | * MIT Licensed 5 | */ 6 | 7 | @import "ui-variables"; 8 | 9 | // Icons 10 | .xatom-icon { 11 | width: 13px; 12 | height: 16px; 13 | display: inline-block; 14 | vertical-align: middle; 15 | -webkit-mask-size: contain; 16 | -webkit-mask-repeat: no-repeat; 17 | -webkit-mask-position: top center; 18 | &[name="run"] { 19 | -webkit-mask-image: url('atom://xatom-debug/icons/run.svg'); 20 | background-color: @text-color; 21 | } 22 | &[name="stop"] { 23 | -webkit-mask-image: url('atom://xatom-debug/icons/stop.svg'); 24 | background-color: @text-color; 25 | } 26 | &[name="continue"] { 27 | -webkit-mask-image: url('atom://xatom-debug/icons/continue.svg'); 28 | // background-color: @text-color; 29 | background-color: @background-color-success; 30 | } 31 | &[name="pause"] { 32 | -webkit-mask-image: url('atom://xatom-debug/icons/pause.svg'); 33 | // background-color: @text-color; 34 | background-color: @background-color-error; 35 | } 36 | &[name="step-into"] { 37 | -webkit-mask-image: url('atom://xatom-debug/icons/step-into.svg'); 38 | background-color: @text-color; 39 | } 40 | &[name="step-out"] { 41 | -webkit-mask-image: url('atom://xatom-debug/icons/step-out.svg'); 42 | background-color: @text-color; 43 | } 44 | &[name="step-over"] { 45 | -webkit-mask-image: url('atom://xatom-debug/icons/step-over.svg'); 46 | background-color: @text-color; 47 | } 48 | &[name="collapse-in"] { 49 | -webkit-mask-image: url('atom://xatom-debug/icons/collapse-in.svg'); 50 | background-color: @text-color; 51 | } 52 | &[name="collapse-out"] { 53 | -webkit-mask-image: url('atom://xatom-debug/icons/collapse-out.svg'); 54 | background-color: @text-color; 55 | } 56 | &[name="success"] { 57 | -webkit-mask-image: url('atom://xatom-debug/icons/status-success.svg'); 58 | background-color: @background-color-success; 59 | } 60 | &[name="warning"] { 61 | -webkit-mask-image: url('atom://xatom-debug/icons/status-warning.svg'); 62 | background-color: @background-color-warning; 63 | } 64 | &[name="error"] { 65 | -webkit-mask-image: url('atom://xatom-debug/icons/status-error.svg'); 66 | background-color: @background-color-error; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /styles/xatom-debug-location.less: -------------------------------------------------------------------------------- 1 | @import "ui-variables"; 2 | 3 | .xatom-debug-location { 4 | &.line, 5 | &.line-number { 6 | background-color: fadeOut(@text-color, 60%)!important; 7 | } 8 | &.xatom-debug-location-breakpoint { 9 | &.line, 10 | &.line-number { 11 | background-color: fadeOut(@background-color-info, 40%)!important; 12 | } 13 | } 14 | &.xatom-debug-location-exception { 15 | &.line, 16 | &.line-number { 17 | background-color: fadeOut(@background-color-error, 50%)!important; 18 | } 19 | } 20 | &.line { 21 | opacity: 1; 22 | border-left: 0; 23 | } 24 | &.line-number { 25 | opacity: 1; 26 | border-right: 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /styles/xatom-debug-toolbar.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * XAtom Debug 3 | * Copyright(c) 2017 Williams Medina 4 | * MIT Licensed 5 | */ 6 | @import "ui-variables"; 7 | 8 | .btn-select { 9 | position: relative; 10 | &:after { 11 | width: 12px; 12 | height: 12px; 13 | position: absolute; 14 | content: ''; 15 | right: 0; 16 | top: 50%; 17 | margin-top: -6px; 18 | z-index: 1; 19 | -webkit-mask-size: contain; 20 | -webkit-mask-repeat: no-repeat; 21 | -webkit-mask-position: top center; 22 | -webkit-mask-image: url('atom://xatom-debug/icons/select.svg'); 23 | background-color: @text-color; 24 | } 25 | select { 26 | position: relative; 27 | background-color: transparent; 28 | border: none; 29 | -webkit-appearance: none; 30 | padding: 0 15px; 31 | z-index: 2; 32 | } 33 | } 34 | 35 | xatom-debug-toolbar { 36 | padding: 7px 15px; 37 | display: block; 38 | .xatom-debug-status { 39 | width: auto; 40 | max-width: 300px; 41 | white-space: nowrap; 42 | overflow: hidden; 43 | box-sizing: border-box; 44 | text-overflow: ellipsis; 45 | .xatom-debug-status-text { 46 | width: 100%; 47 | white-space: nowrap; 48 | overflow: hidden; 49 | text-overflow: ellipsis; 50 | } 51 | } 52 | // Buttons 53 | .btn-separator { 54 | position: relative; 55 | z-index: 2!important; 56 | padding-left: 0; 57 | padding-right: 0; 58 | border-right: none!important; 59 | select { 60 | margin-right: -14px; 61 | padding-right: 29px; 62 | } 63 | & + .btn { 64 | padding-left: 27px; 65 | margin-left: -2px; 66 | } 67 | &:hover .arrow:before { 68 | background-color: @button-background-color-hover; 69 | } 70 | &:focus { 71 | background-color: @button-background-color; 72 | border-right: none; 73 | .arrow:before { 74 | border-color: @button-background-color-selected; 75 | background-color: @button-background-color; 76 | } 77 | } 78 | &:active .arrow:before { 79 | background-color: @button-background-color-selected; 80 | } 81 | &.disabled .arrow:before, 82 | &[disabled] .arrow:before{ 83 | opacity: .65; 84 | } 85 | .arrow { 86 | position: absolute; 87 | top: 0; 88 | right: -14px; 89 | overflow: hidden; 90 | height: 100%; 91 | width: 14px; 92 | &:before { 93 | position: absolute; 94 | content: ''; 95 | background-color: @button-background-color; 96 | transform: rotate(-45deg); 97 | width: 30px; 98 | height: 30px; 99 | top: 50%; 100 | margin-top: -15px; 101 | right: 5px; 102 | border-radius: 0 0 5px 0; 103 | border: 1px solid @button-border-color; 104 | } 105 | } 106 | } 107 | // Status 108 | .xatom-debug-status { 109 | margin-left: 1.5rem!important; 110 | position: relative; 111 | &.loading:before { 112 | content: ''; 113 | position: absolute; 114 | bottom: 0; 115 | left: 0; 116 | width: 0%; 117 | height: 2px; 118 | background-color: @background-color-info; 119 | animation: loading 1.2s linear alternate infinite; 120 | border-bottom-left-radius: @component-border-radius; 121 | border-bottom-right-radius: @component-border-radius; 122 | } 123 | } 124 | } 125 | 126 | @keyframes marquee { 127 | 0% { transform: translate(0, 0); } 128 | 100% { transform: translate(-100%, 0); } 129 | } 130 | 131 | @keyframes loading { 132 | 0% { 133 | left: 0; 134 | width: 0% 135 | } 136 | 25% { 137 | left: 0; 138 | width: 33%; 139 | } 140 | 50% { 141 | left: 33%; 142 | width: 67%; 143 | } 144 | 75% { 145 | left: 67%; 146 | width: 33%; 147 | } 148 | 100% { 149 | left: 100%; 150 | width: 0%; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /styles/xatom-group.less: -------------------------------------------------------------------------------- 1 | @import "ui-variables"; 2 | 3 | xatom-group { 4 | flex: 1; 5 | display: flex; 6 | flex-direction: column; 7 | section.xatom-group-body { 8 | max-height: 200px; 9 | overflow: auto; 10 | } 11 | header.xatom-group-header { 12 | display: flex; 13 | align-items: center; 14 | border-bottom: 1px solid @panel-heading-border-color; 15 | padding: 0 5px; 16 | .btn { 17 | background-color: transparent; 18 | } 19 | .xatom-icon { 20 | width: 16px; 21 | height: 20px; 22 | } 23 | .xatom-group-title { 24 | font-weight: bold; 25 | padding: 0 10px; 26 | line-height: 2.5em; 27 | overflow: hidden; 28 | text-overflow: ellipsis; 29 | flex: 1; 30 | } 31 | } 32 | .xatom-group-item { 33 | position: relative; 34 | display: flex; 35 | align-items: flex-start; 36 | padding: 5px 10px; 37 | padding-left: 16px; 38 | overflow: hidden; 39 | -webkit-user-select: none; 40 | cursor: default; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/.xatom.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/willyelm/xatom-debug/8d919ea68dcddba957d1129da06a56ad5db9ad9d/test/.xatom.json -------------------------------------------------------------------------------- /test/lib/greet.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function Greet(person) { 4 | return "Hi!, my name is " + person.name; 5 | } 6 | exports.Greet = Greet; 7 | //# sourceMappingURL=greet.js.map -------------------------------------------------------------------------------- /test/lib/greet.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"greet.js","sourceRoot":"","sources":["../src/greet.ts"],"names":[],"mappings":";;AAEA,eAAuB,MAAc;IACnC,MAAM,CAAC,qBAAmB,MAAM,CAAC,IAAM,CAAC;AAC1C,CAAC;AAFD,sBAEC","sourcesContent":["import { Person } from './person';\n\nexport function Greet (person: Person) {\n return `Hi!, my name is ${person.name}`;\n}\n"]} -------------------------------------------------------------------------------- /test/lib/person.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | ; 4 | //# sourceMappingURL=person.js.map -------------------------------------------------------------------------------- /test/lib/person.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"person.js","sourceRoot":"","sources":["../src/person.ts"],"names":[],"mappings":";;AAKC,CAAC","sourcesContent":["export interface Person {\n name: string,\n age: number,\n active: boolean,\n dateOfBirth: Date\n};\n"]} -------------------------------------------------------------------------------- /test/lib/some/really/large/path/to/display/my/file/and/alsoalargefilenametotest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function Test() { 4 | throw new Error('test'); 5 | } 6 | exports.Test = Test; 7 | //# sourceMappingURL=alsoalargefilenametotest.js.map -------------------------------------------------------------------------------- /test/lib/some/really/large/path/to/display/my/file/and/alsoalargefilenametotest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"alsoalargefilenametotest.js","sourceRoot":"","sources":["../../../../../../../../../../src/some/really/large/path/to/display/my/file/and/alsoalargefilenametotest.ts"],"names":[],"mappings":";;AAAA;IACE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAFD,oBAEC","sourcesContent":["export function Test () {\n throw new Error('test');\n}\n"]} -------------------------------------------------------------------------------- /test/lib/test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var greet_1 = require("./greet"); 4 | var alsoalargefilenametotest_1 = require("./some/really/large/path/to/display/my/file/and/alsoalargefilenametotest"); 5 | var person2 = { 6 | name: 'Lavinia Dinu', 7 | age: 25, 8 | active: true, 9 | dateOfBirth: new Date(1992, 2, 25) 10 | }; 11 | var person1 = { 12 | name: 'Williams Medina', 13 | age: 28, 14 | active: true, 15 | dateOfBirth: new Date(1989, 0, 28) 16 | }; 17 | console.log(person1); 18 | console.log(greet_1.Greet(person1)); 19 | console.log(greet_1.Greet(person2)); 20 | alsoalargefilenametotest_1.Test(); 21 | //# sourceMappingURL=test.js.map -------------------------------------------------------------------------------- /test/lib/test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,iCAAgC;AAEhC,qHAAgG;AAEhG,IAAI,OAAO,GAAW;IACpB,IAAI,EAAE,cAAc;IACpB,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;CACnC,CAAC;AAEF,IAAI,OAAO,GAAW;IACpB,IAAI,EAAE,iBAAiB;IACvB,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;CACnC,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACrB,OAAO,CAAC,GAAG,CAAC,aAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,aAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAE5B,+BAAI,EAAE,CAAC","sourcesContent":["import { Greet } from './greet';\nimport { Person } from './person';\nimport { Test } from './some/really/large/path/to/display/my/file/and/alsoalargefilenametotest';\n\nvar person2: Person = {\n name: 'Lavinia Dinu',\n age: 25,\n active: true,\n dateOfBirth: new Date(1992, 2, 25)\n};\n\nvar person1: Person = {\n name: 'Williams Medina',\n age: 28,\n active: true,\n dateOfBirth: new Date(1989, 0, 28)\n};\n\nconsole.log(person1);\nconsole.log(Greet(person1));\nconsole.log(Greet(person2));\n\nTest();\n"]} -------------------------------------------------------------------------------- /test/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debuggertest", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "dependencies": { 6 | "typescript": { 7 | "version": "2.5.2", 8 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", 9 | "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debuggertest", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "directories": { 7 | "lib": "lib" 8 | }, 9 | "scripts": { 10 | "start": "tsc -w" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "typescript": "^2.5.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/src/greet.ts: -------------------------------------------------------------------------------- 1 | import { Person } from './person'; 2 | 3 | export function Greet (person: Person) { 4 | return `Hi!, my name is ${person.name}`; 5 | } 6 | -------------------------------------------------------------------------------- /test/src/person.ts: -------------------------------------------------------------------------------- 1 | export interface Person { 2 | name: string, 3 | age: number, 4 | active: boolean, 5 | dateOfBirth: Date 6 | }; 7 | -------------------------------------------------------------------------------- /test/src/some/really/large/path/to/display/my/file/and/alsoalargefilenametotest.ts: -------------------------------------------------------------------------------- 1 | export function Test () { 2 | throw new Error('test'); 3 | } 4 | -------------------------------------------------------------------------------- /test/src/test.ts: -------------------------------------------------------------------------------- 1 | import { Greet } from './greet'; 2 | import { Person } from './person'; 3 | import { Test } from './some/really/large/path/to/display/my/file/and/alsoalargefilenametotest'; 4 | 5 | var person2: Person = { 6 | name: 'Lavinia Dinu', 7 | age: 25, 8 | active: true, 9 | dateOfBirth: new Date(1992, 2, 25) 10 | }; 11 | 12 | var person1: Person = { 13 | name: 'Williams Medina', 14 | age: 28, 15 | active: true, 16 | dateOfBirth: new Date(1989, 0, 28) 17 | }; 18 | 19 | console.log(person1); 20 | console.log(Greet(person1)); 21 | console.log(Greet(person2)); 22 | 23 | Test(); 24 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "moduleResolution": "node", 5 | "lib": ["es6", "dom"], 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | /*"inlineSourceMap": true,*/ 9 | "typeRoots": [ 10 | "node_modules/@types" 11 | ], 12 | "inlineSources": true, 13 | "removeComments": true, 14 | "skipLibCheck": true 15 | }, 16 | "compileOnSave": false, 17 | "include": [ 18 | "node_modules/@types", 19 | "src/**/*.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "declaration": false, 5 | "noImplicitAny": false, 6 | "skipLibCheck": true, 7 | "experimentalDecorators": true, 8 | "emitDecoratorMetadata": true, 9 | "moduleResolution": "node", 10 | "removeComments": false, 11 | "outDir": "lib", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2016", 17 | "dom" 18 | ], 19 | "sourceMap": true, 20 | "inlineSources": true 21 | }, 22 | "compileOnSave": false, 23 | "include": [ 24 | "index.d.ts", 25 | "./src2/**/*.ts" 26 | ] 27 | } 28 | --------------------------------------------------------------------------------