|
1 |
| -import type { |
2 |
| - AutoGenConfig, |
3 |
| - NuclideDebuggerProvider, |
4 |
| -} from '@atom-ide-community/nuclide-debugger-common/types'; |
5 |
| -import * as React from 'react'; |
6 |
| -import path from 'path'; |
7 |
| -import {AutoGenLaunchAttachProvider} from '@atom-ide-community/nuclide-debugger-common/AutoGenLaunchAttachProvider'; |
| 1 | +import type { AutoGenConfig, NuclideDebuggerProvider } from "@atom-ide-community/nuclide-debugger-common/types" |
| 2 | +import * as React from "react" |
| 3 | +import path from "path" |
| 4 | +import { AutoGenLaunchAttachProvider } from "@atom-ide-community/nuclide-debugger-common/AutoGenLaunchAttachProvider" |
8 | 5 |
|
9 | 6 | export function createNodeDebuggerProvider(): NuclideDebuggerProvider {
|
10 | 7 | return {
|
11 |
| - type: 'node', |
12 |
| - getLaunchAttachProvider: connection => { |
13 |
| - return new AutoGenLaunchAttachProvider( |
14 |
| - 'Node', |
15 |
| - connection, |
16 |
| - getNodeConfig(), |
17 |
| - ); |
| 8 | + type: "node", |
| 9 | + getLaunchAttachProvider: (connection) => { |
| 10 | + return new AutoGenLaunchAttachProvider("Node", connection, getNodeConfig()) |
18 | 11 | },
|
19 |
| - }; |
| 12 | + } |
20 | 13 | }
|
21 | 14 |
|
22 | 15 | function getNodeConfig(): AutoGenConfig {
|
23 | 16 | const program = {
|
24 |
| - name: 'program', |
25 |
| - type: 'string', |
26 |
| - description: 'Absolute path to the program.', |
| 17 | + name: "program", |
| 18 | + type: "string", |
| 19 | + description: "Absolute path to the program.", |
27 | 20 | required: true,
|
28 | 21 | visible: true,
|
29 |
| - }; |
| 22 | + } |
30 | 23 | const cwd = {
|
31 |
| - name: 'cwd', |
32 |
| - type: 'string', |
33 |
| - description: |
34 |
| - 'Absolute path to the working directory of the program being debugged.', |
| 24 | + name: "cwd", |
| 25 | + type: "string", |
| 26 | + description: "Absolute path to the working directory of the program being debugged.", |
35 | 27 | required: true,
|
36 | 28 | visible: true,
|
37 |
| - }; |
| 29 | + } |
38 | 30 | const stopOnEntry = {
|
39 |
| - name: 'stopOnEntry', |
40 |
| - type: 'boolean', |
41 |
| - description: 'Automatically stop program after launch.', |
| 31 | + name: "stopOnEntry", |
| 32 | + type: "boolean", |
| 33 | + description: "Automatically stop program after launch.", |
42 | 34 | defaultValue: false,
|
43 | 35 | required: false,
|
44 | 36 | visible: true,
|
45 |
| - }; |
| 37 | + } |
46 | 38 |
|
47 | 39 | const args = {
|
48 |
| - name: 'args', |
49 |
| - type: 'array', |
50 |
| - itemType: 'string', |
51 |
| - description: 'Command line arguments passed to the program.', |
| 40 | + name: "args", |
| 41 | + type: "array", |
| 42 | + itemType: "string", |
| 43 | + description: "Command line arguments passed to the program.", |
52 | 44 | defaultValue: [],
|
53 | 45 | required: false,
|
54 | 46 | visible: true,
|
55 |
| - }; |
| 47 | + } |
56 | 48 | const runtimeExecutable = {
|
57 |
| - name: 'runtimeExecutable', |
58 |
| - type: 'string', |
59 |
| - description: |
60 |
| - '(Optional) Runtime to use, an absolute path or the name of a runtime available on PATH', |
| 49 | + name: "runtimeExecutable", |
| 50 | + type: "string", |
| 51 | + description: "(Optional) Runtime to use, an absolute path or the name of a runtime available on PATH", |
61 | 52 | required: false,
|
62 | 53 | visible: true,
|
63 |
| - }; |
| 54 | + } |
64 | 55 | const env = {
|
65 |
| - name: 'env', |
66 |
| - type: 'object', |
67 |
| - description: |
68 |
| - '(Optional) Environment variables (e.g. SHELL=/bin/bash PATH=/bin)', |
| 56 | + name: "env", |
| 57 | + type: "object", |
| 58 | + description: "(Optional) Environment variables (e.g. SHELL=/bin/bash PATH=/bin)", |
69 | 59 | defaultValue: {},
|
70 | 60 | required: false,
|
71 | 61 | visible: true,
|
72 |
| - }; |
| 62 | + } |
73 | 63 | const outFiles = {
|
74 |
| - name: 'outFiles', |
75 |
| - type: 'array', |
76 |
| - itemType: 'string', |
77 |
| - description: |
78 |
| - '(Optional) When source maps are enabled, these glob patterns specify the generated JavaScript files', |
| 64 | + name: "outFiles", |
| 65 | + type: "array", |
| 66 | + itemType: "string", |
| 67 | + description: "(Optional) When source maps are enabled, these glob patterns specify the generated JavaScript files", |
79 | 68 | defaultValue: [],
|
80 | 69 | required: false,
|
81 | 70 | visible: true,
|
82 |
| - }; |
| 71 | + } |
83 | 72 | const protocol = {
|
84 |
| - name: 'protocol', |
85 |
| - type: 'string', |
86 |
| - description: '', |
87 |
| - defaultValue: 'inspector', |
| 73 | + name: "protocol", |
| 74 | + type: "string", |
| 75 | + description: "", |
| 76 | + defaultValue: "inspector", |
88 | 77 | required: false,
|
89 | 78 | visible: false,
|
90 |
| - }; |
| 79 | + } |
91 | 80 |
|
92 | 81 | const consoleEnum = {
|
93 |
| - name: 'console', |
94 |
| - type: 'enum', |
95 |
| - enums: ['internalConsole', 'integratedTerminal'], |
| 82 | + name: "console", |
| 83 | + type: "enum", |
| 84 | + enums: ["internalConsole", "integratedTerminal"], |
96 | 85 | description:
|
97 |
| - 'Integrated Terminal means that it will run in a terminal that can interact with standard input and output.', |
98 |
| - defaultValue: 'internalConsole', |
| 86 | + "Integrated Terminal means that it will run in a terminal that can interact with standard input and output.", |
| 87 | + defaultValue: "internalConsole", |
99 | 88 | required: true,
|
100 | 89 | visible: true,
|
101 |
| - }; |
| 90 | + } |
102 | 91 |
|
103 | 92 | const port = {
|
104 |
| - name: 'port', |
105 |
| - type: 'number', |
106 |
| - description: 'Port', |
| 93 | + name: "port", |
| 94 | + type: "number", |
| 95 | + description: "Port", |
107 | 96 | required: true,
|
108 | 97 | visible: true,
|
109 |
| - }; |
| 98 | + } |
110 | 99 |
|
111 | 100 | const adapterExecutable = {
|
112 |
| - command: 'node', |
113 |
| - args: [ |
114 |
| - path.resolve(path.join(__dirname, 'VendorLib/vscode-node-debug2/out/src/nodeDebug.js')) |
115 |
| - ], |
| 101 | + command: "node", |
| 102 | + args: [path.resolve(path.join(__dirname, "VendorLib/vscode-node-debug2/out/src/nodeDebug.js"))], |
116 | 103 | }
|
117 |
| - const adapterRoot = path.resolve(path.join(__dirname, 'VendorLib/vscode-node-debug2')) |
| 104 | + const adapterRoot = path.resolve(path.join(__dirname, "VendorLib/vscode-node-debug2")) |
118 | 105 |
|
119 | 106 | return {
|
120 | 107 | launch: {
|
121 | 108 | launch: true,
|
122 |
| - vsAdapterType: 'node', |
| 109 | + vsAdapterType: "node", |
123 | 110 | adapterExecutable,
|
124 | 111 | adapterRoot,
|
125 |
| - properties: [ |
126 |
| - program, |
127 |
| - cwd, |
128 |
| - stopOnEntry, |
129 |
| - args, |
130 |
| - runtimeExecutable, |
131 |
| - env, |
132 |
| - outFiles, |
133 |
| - protocol, |
134 |
| - consoleEnum, |
135 |
| - ], |
136 |
| - scriptPropertyName: 'program', |
137 |
| - cwdPropertyName: 'cwd', |
138 |
| - scriptExtension: '.js', |
139 |
| - header: ( |
140 |
| - <p>This is intended to debug node.js files (for node version 6.3+).</p> |
141 |
| - ), |
| 112 | + properties: [program, cwd, stopOnEntry, args, runtimeExecutable, env, outFiles, protocol, consoleEnum], |
| 113 | + scriptPropertyName: "program", |
| 114 | + cwdPropertyName: "cwd", |
| 115 | + scriptExtension: ".js", |
| 116 | + header: <p>This is intended to debug node.js files (for node version 6.3+).</p>, |
142 | 117 | getProcessName(values) {
|
143 |
| - let processName = values.program; |
144 |
| - const lastSlash = processName.lastIndexOf('/'); |
| 118 | + let processName = values.program |
| 119 | + const lastSlash = processName.lastIndexOf("/") |
145 | 120 | if (lastSlash >= 0) {
|
146 |
| - processName = processName.substring( |
147 |
| - lastSlash + 1, |
148 |
| - processName.length, |
149 |
| - ); |
| 121 | + processName = processName.substring(lastSlash + 1, processName.length) |
150 | 122 | }
|
151 |
| - return processName + ' (Node)'; |
| 123 | + return processName + " (Node)" |
152 | 124 | },
|
153 | 125 | },
|
154 | 126 | attach: {
|
155 | 127 | launch: false,
|
156 |
| - vsAdapterType: 'node', |
| 128 | + vsAdapterType: "node", |
157 | 129 | adapterExecutable,
|
158 | 130 | adapterRoot,
|
159 | 131 | properties: [port],
|
160 |
| - scriptExtension: '.js', |
| 132 | + scriptExtension: ".js", |
161 | 133 | header: <p>Attach to a running node.js process</p>,
|
162 | 134 | getProcessName(values) {
|
163 |
| - return 'Port: ' + values.port + ' (Node attach)'; |
| 135 | + return "Port: " + values.port + " (Node attach)" |
164 | 136 | },
|
165 | 137 | },
|
166 |
| - }; |
| 138 | + } |
167 | 139 | }
|
0 commit comments