11import * as vscode from 'vscode' ;
22import * as cp from 'child_process' ;
3- < < < << << HEAD
43import * as path from 'path' ;
54import {
65 LanguageClient ,
@@ -10,14 +9,11 @@ import {
109} from 'vscode-languageclient/node' ;
1110
1211let client : LanguageClient ;
13- === === =
14- > >>> >>> fix - ci - build
1512
1613export function activate ( context : vscode . ExtensionContext ) {
1714 const diagnosticCollection = vscode . languages . createDiagnosticCollection ( 'proxpl' ) ;
1815 context . subscriptions . push ( diagnosticCollection ) ;
1916
20- << << << < HEAD
2117 vscode . window . showInformationMessage ( 'ProX Studio Alpha started.' ) ;
2218
2319 // --- LSP Client Setup ---
@@ -54,8 +50,6 @@ export function activate(context: vscode.ExtensionContext) {
5450 client . start ( ) ;
5551
5652
57- === = ===
58- > >>> > >> fix - ci - build
5953 // 1. Code Runner Command
6054 let runCommand = vscode . commands . registerCommand ( 'proxpl.run' , ( ) => {
6155 const editor = vscode . window . activeTextEditor ;
@@ -65,13 +59,8 @@ export function activate(context: vscode.ExtensionContext) {
6559 }
6660
6761 const fileName = editor . document . fileName ;
68- < < < << << HEAD
6962 if ( ! fileName . endsWith ( '.prox' ) && ! fileName . endsWith ( '.pxpl' ) ) {
7063 vscode . window . showErrorMessage ( 'Not a ProXPL (.prox or .pxpl) file.' ) ;
71- === === =
72- if ( ! fileName . endsWith ( '.prox' ) ) {
73- vscode . window . showErrorMessage ( 'Not a ProXPL (.prox) file.' ) ;
74- >>> > >>> fix - ci - build
7564 return ;
7665 }
7766
@@ -91,7 +80,6 @@ export function activate(context: vscode.ExtensionContext) {
9180
9281 // Save file before running
9382 editor . document . save ( ) . then ( ( ) => {
94- < < < << << HEAD
9583 let terminal = vscode . window . terminals . find ( t => t . name === 'ProXPL' ) ;
9684 if ( ! terminal ) {
9785 terminal = vscode . window . createTerminal ( 'ProXPL' ) ;
@@ -107,79 +95,6 @@ export function activate(context: vscode.ExtensionContext) {
10795 // ... (intermediate code skipped) ...
10896
10997 // 4. Hover Support
110- === = ===
111- const terminal = vscode . window . activeTerminal || vscode . window . createTerminal ( 'ProXPL' ) ;
112- terminal . show ( ) ;
113- terminal . sendText ( `proxpl run "${ fileName } "` ) ;
114-
115- // Background execution for diagnostics
116- cp . exec ( `proxpl check "${ fileName } "` , ( error : Error | null , stdout : string , stderr : string ) => {
117- diagnosticCollection . clear ( ) ;
118- const diagnostics : vscode . Diagnostic [ ] = [ ] ;
119- const errorLog = stderr || stdout ;
120- const errorLines = errorLog . split ( '\n' ) ;
121-
122- errorLines . forEach ( ( line : string ) => {
123- const match = line . match ( / E r r o r a t l i n e ( \d + ) : ( .* ) / ) ;
124- if ( match ) {
125- const lineNum = mapLineNumber ( match [ 1 ] ) ;
126- const message = match [ 2 ] ;
127- const range = new vscode . Range ( lineNum , 0 , lineNum , 100 ) ;
128- diagnostics . push ( new vscode . Diagnostic ( range , message , vscode . DiagnosticSeverity . Error ) ) ;
129- }
130- } ) ;
131-
132- diagnosticCollection . set ( editor . document . uri , diagnostics ) ;
133- } ) ;
134- } ) ;
135- } ) ;
136- } ) ;
137- context . subscriptions . push ( runCommand ) ;
138-
139- // 2. Formatter Provider
140- const formattingProvider = vscode . languages . registerDocumentFormattingEditProvider ( 'proxpl' , {
141- provideDocumentFormattingEdits ( document : vscode . TextDocument ) : vscode . TextEdit [ ] {
142- const edits : vscode . TextEdit [ ] = [ ] ;
143- let lastLineWasEmpty = false ;
144-
145- for ( let i = 0 ; i < document . lineCount ; i ++ ) {
146- const line = document . lineAt ( i ) ;
147- const text = line . text ;
148-
149- // 1. Remove extra empty lines (consecutive empty lines)
150- if ( text . trim ( ) === '' ) {
151- if ( lastLineWasEmpty ) {
152- // Delete this extra empty line
153- edits . push ( vscode . TextEdit . delete ( line . rangeIncludingLineBreak ) ) ;
154- continue ;
155- }
156- lastLineWasEmpty = true ;
157- } else {
158- lastLineWasEmpty = false ;
159- }
160-
161- // 2. Remove trailing whitespace
162- if ( text . endsWith ( ' ' ) || text . endsWith ( '\t' ) ) {
163- edits . push ( vscode . TextEdit . delete ( new vscode . Range ( i , text . trimEnd ( ) . length , i , text . length ) ) ) ;
164- }
165-
166- // 3. Basic Indentation (Fix to 4 spaces)
167- const indentMatch = text . match ( / ^ ( \s + ) / ) ;
168- if ( indentMatch ) {
169- const oldIndent = indentMatch [ 1 ] ;
170- const newIndent = oldIndent . replace ( / \t / g, ' ' ) ;
171- if ( oldIndent !== newIndent ) {
172- edits . push ( vscode . TextEdit . replace ( new vscode . Range ( i , 0 , i , oldIndent . length ) , newIndent ) ) ;
173- }
174- }
175- }
176- return edits ;
177- }
178- } ) ;
179- context . subscriptions . push ( formattingProvider ) ;
180-
181- // 3. Hover Support
182- >>> > >>> fix - ci - build
18398 const hoverProvider = vscode . languages . registerHoverProvider ( 'proxpl' , {
18499 provideHover ( document : vscode . TextDocument , position : vscode . Position ) {
185100 const range = document . getWordRangeAtPosition ( position ) ;
@@ -188,7 +103,6 @@ export function activate(context: vscode.ExtensionContext) {
188103
189104 const descriptions : { [ key : string ] : string } = {
190105 'func' : 'Defines a new function in ProXPL. Syntax: `func name(params) { ... }`' ,
191- < << << << HEAD
192106 'var' : 'Declares a new variable.' ,
193107 'let' : 'Declares a mutable variable.' ,
194108 'const' : 'Declares an immutable constant.' ,
@@ -220,15 +134,6 @@ export function activate(context: vscode.ExtensionContext) {
220134 'try' : 'Starts a block of code to test for errors.' ,
221135 'catch' : 'Handles errors thrown in the try block.' ,
222136 'throw' : 'Throws an error/exception.'
223- === = ===
224- 'var' : 'Declares a new variable. ProXPL is dynamically typed but variables must be declared.' ,
225- 'if' : 'Conditional statement. Executes a block if the condition is true.' ,
226- 'else' : 'Defines an alternative block for an `if` statement.' ,
227- 'while' : 'Loop that continues as long as a condition is true.' ,
228- 'return' : 'Exits a function and optionally returns a value.' ,
229- 'print' : 'Built-in function to output values to the terminal.' ,
230- 'import' : 'Incorporates external modules into the current script.'
231- >>> > >>> fix - ci - build
232137 } ;
233138
234139 if ( descriptions [ word ] ) {
@@ -238,7 +143,6 @@ export function activate(context: vscode.ExtensionContext) {
238143 }
239144 } ) ;
240145 context . subscriptions . push ( hoverProvider ) ;
241- << < < < << HEAD
242146
243147 // 5. Definition Provider (Basic "Go to Definition")
244148 const definitionProvider = vscode . languages . registerDefinitionProvider ( 'proxpl' , {
@@ -326,22 +230,16 @@ class ProXDebugAdapter implements vscode.DebugAdapter {
326230 dispose ( ) {
327231
328232 }
329- === === =
330- > >>> >>> fix - ci - build
331233}
332234
333235function mapLineNumber ( lineStr : string ) : number {
334236 const num = parseInt ( lineStr ) ;
335237 return isNaN ( num ) ? 0 : num - 1 ;
336238}
337239
338- << < < < << HEAD
339240export function deactivate ( ) : Thenable < void > | undefined {
340241 if ( ! client ) {
341242 return undefined ;
342243 }
343244 return client . stop ( ) ;
344245}
345- === = ===
346- export function deactivate ( ) { }
347- >>> > >>> fix - ci - build
0 commit comments