mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-07-23 11:15:27 +00:00
Some exported functions for later testing
This commit is contained in:
parent
80c40fc427
commit
d7d41985ef
2 changed files with 7 additions and 7 deletions
|
@ -6,11 +6,11 @@ Want to contribute? I sure want you to! Heres how you can help:
|
||||||
|
|
||||||
Development requirements (did I miss any? Submit a PR!):
|
Development requirements (did I miss any? Submit a PR!):
|
||||||
|
|
||||||
`git`, `npm`, `nodejs`, `VSCode`, (optional) `python3`
|
`git`, `npm`, `nodejs`, `VSCode`, `python3` (optional)
|
||||||
|
|
||||||
Fork the repo (you are using [SSH keys](https://help.github.com/articles/connecting-to-github-with-ssh/), right?):
|
Fork the repo and clone it (you are using [SSH keys](https://help.github.com/articles/connecting-to-github-with-ssh/), right?):
|
||||||
|
|
||||||
`git clone git@github.com:Strum355/vscode-mc-shader.git`
|
`git clone git@github.com:<your-username>/vscode-mc-shader.git`
|
||||||
|
|
||||||
Install dependencies:
|
Install dependencies:
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ export function preprocess(lines: string[], docURI: string, topLevel: boolean, i
|
||||||
export const formatURI = (uri: string) => uri.replace(/^file:\/\//, '')
|
export const formatURI = (uri: string) => uri.replace(/^file:\/\//, '')
|
||||||
|
|
||||||
// TODO no
|
// TODO no
|
||||||
function getIncludes(uri: string, lines: string[]) {
|
export function getIncludes(uri: string, lines: string[]) {
|
||||||
const out: {lineNum: number, lineNumParent: number, parent: string, match: RegExpMatchArray}[] = []
|
const out: {lineNum: number, lineNumParent: number, parent: string, match: RegExpMatchArray}[] = []
|
||||||
const count = [0] // for each file we need to track the line number
|
const count = [0] // for each file we need to track the line number
|
||||||
let total = 0
|
let total = 0
|
||||||
|
@ -137,7 +137,7 @@ function getIncludes(uri: string, lines: string[]) {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInComment(line: string, state: Comment): Comment {
|
export function isInComment(line: string, state: Comment): Comment {
|
||||||
const indexOf = line.indexOf('#include')
|
const indexOf = line.indexOf('#include')
|
||||||
if (indexOf > -1 && line.indexOf('//') < indexOf) {
|
if (indexOf > -1 && line.indexOf('//') < indexOf) {
|
||||||
return Comment.No
|
return Comment.No
|
||||||
|
@ -145,7 +145,7 @@ function isInComment(line: string, state: Comment): Comment {
|
||||||
return Comment.No
|
return Comment.No
|
||||||
}
|
}
|
||||||
|
|
||||||
function absPath(currFile: string, includeFile: string): string {
|
export function absPath(currFile: string, includeFile: string): string {
|
||||||
if (!currFile.startsWith(conf.shaderpacksPath)) {
|
if (!currFile.startsWith(conf.shaderpacksPath)) {
|
||||||
connection.window.showErrorMessage(`Shaderpacks path may not be correct. Current file is in ${currFile} but the path is set to ${conf.shaderpacksPath}`)
|
connection.window.showErrorMessage(`Shaderpacks path may not be correct. Current file is in ${currFile} but the path is set to ${conf.shaderpacksPath}`)
|
||||||
return
|
return
|
||||||
|
@ -189,7 +189,7 @@ function lint(uri: string, lines: string[], includes: string[]) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceWord = (msg: string) => Object.entries(tokens).reduce((acc, [key, value]) => acc.replace(key, value), msg)
|
export const replaceWord = (msg: string) => Object.entries(tokens).reduce((acc, [key, value]) => acc.replace(key, value), msg)
|
||||||
|
|
||||||
const daigsArray = (diags: Map<string, Diagnostic[]>) => Array.from(diags).map(kv => ({uri: 'file://' + kv[0], diag: kv[1]}))
|
const daigsArray = (diags: Map<string, Diagnostic[]>) => Array.from(diags).map(kv => ({uri: 'file://' + kv[0], diag: kv[1]}))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue