-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: first test running outside integration
- Loading branch information
Showing
11 changed files
with
113 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as vscode from 'vscode' | ||
|
||
export const createRange = (line: number, column: number, length: number): vscode.Range => | ||
new vscode.Range( | ||
new vscode.Position(line, column), | ||
new vscode.Position(line, column + length), | ||
) | ||
|
||
export type NodePlotter = { | ||
range: vscode.Range | ||
tokenType: string | ||
tokenModifiers?: string[] | ||
} | ||
|
||
// export const createRange = (line: number, column: number, length: number): Range => | ||
// ({ | ||
// start: { | ||
// line, column, | ||
// }, | ||
// end: { | ||
// line, | ||
// column: column + length, | ||
// }, | ||
// }) | ||
|
||
// export type Position = { | ||
// line: number, | ||
// column: number, | ||
// } | ||
|
||
// export type Range = { | ||
// start: Position, | ||
// end: Position, | ||
// } | ||
|
||
// export type NodePlotter = { | ||
// range: Range | ||
// tokenType: string | ||
// tokenModifiers?: string[] | ||
// } |
11 changes: 11 additions & 0 deletions
11
packages/client/src/test/highlighter/highlighter-samples/objectSample.wlk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
object pepita { | ||
var property energy = 100 | ||
const nombre = "Pepita" | ||
|
||
method fly(minutes) { | ||
energy = energy + (10 * minutes) | ||
} | ||
|
||
method realEnergy() = energy * self.nameValue() | ||
method nameValue() = nombre.length() | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/client/src/test/highlighter/tokenProvider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { excludeNullish, parse } from 'wollok-ts' | ||
import { readFileSync } from 'fs' | ||
import { processCode } from '../../highlighter/tokenProvider' | ||
|
||
suite('an object sample', () => { | ||
|
||
let processed: string[] | ||
|
||
setup(() => { | ||
const filePath = 'src/test/highlighter/highlighter-samples/objectSample.wlk' | ||
const parsedFile = parse.File(filePath) | ||
const docText = readFileSync(filePath, { encoding: 'utf-8' }) | ||
const tp = parsedFile.tryParse(docText) | ||
const splittedLines = docText.split('\n') | ||
processed = excludeNullish([] | ||
.concat(processCode(tp.members[0], splittedLines))) | ||
|
||
}) | ||
|
||
test('highlights object keyword', () => { | ||
console.info(processed) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,6 @@ | |
"mocha": "^10.7.3", | ||
"nyc": "^17.0.0", | ||
"ts-mocha": "^10.0.0", | ||
"wollok-ts": "4.1.6" | ||
"wollok-ts": "4.1.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters