Skip to content

Commit

Permalink
Add comments to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Dec 28, 2024
1 parent 1ffc325 commit 7f930ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/highlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const convertToVSCPosition = (position: WollokPosition) =>
new vscode.Position(position.line, position.column)

const convertToVSCTokens = (wollokNodesPlotter: WollokNodePlotter[]) =>
excludeNullish(wollokNodesPlotter)
wollokNodesPlotter
.filter(wollokNodePlotter => {
const { range } = wollokNodePlotter
return !!range && range.start && range.end
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/test/highlighter/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { excludeNullish, parse } from 'wollok-ts'
import { readFileSync } from 'fs'
import { processCode } from '../../highlighter/tokenProvider'
import { processCode, processComments } from '../../highlighter/tokenProvider'
import { WollokNodePlotter } from '../../highlighter/utils'

export const readFileForTokenProvider = (filePath: string): WollokNodePlotter[] => {
const parsedFile = parse.File(filePath)
const docText = readFileSync(filePath, { encoding: 'utf-8' })
const tp = parsedFile.tryParse(docText)
const parsedPackage = parsedFile.tryParse(docText)
const splittedLines = docText.split('\n')
return excludeNullish(processCode(tp.members[0], splittedLines))
return excludeNullish(processCode(parsedPackage.members[0], splittedLines)).concat(processComments(splittedLines))
}

export const processedByTokenType = (processed: WollokNodePlotter[], tokenType: string): IterableIterator<WollokNodePlotter> => processed.filter(token => token.tokenType === tokenType).values()

Check warning on line 14 in packages/client/src/test/highlighter/utils.ts

View check run for this annotation

Codecov / codecov/patch

packages/client/src/test/highlighter/utils.ts#L1-L14

Added lines #L1 - L14 were not covered by tests

0 comments on commit 7f930ec

Please sign in to comment.