Skip to content

Commit

Permalink
More improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dynajoe committed Apr 14, 2019
1 parent e7e9a2c commit b736df4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"name": "vscode-tinypg",
"displayName": "vscode-tinypg",
"displayName": "TinyPG",
"description": "Diagnostic information for projects using TinyPG.",
"publisher": "joeandaverde",
"repository": {
"url": "https://github.com/joeandaverde/vscode-tinypg"
},
"bugs": {
"url": "https://github.com/joeandaverde/vscode-tinypg/issues"
},
"version": "1.0.0",
"engines": {
"vscode": "^1.33.0"
Expand Down
8 changes: 4 additions & 4 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ export async function checkForSqlBindings(document: vscode.TextDocument): Promis
.filter(x => _.isNil(x.sql_file.uri))
.map(x => ({ range: x.sql_call_range, key: x.sql_call_key, file: x.sql_file }))

const file_groups = _.groupBy(tiny_calls, x => x.sql_call_key)
const file_groups = _.groupBy(missing_files, x => x.key)

const missing_file_diagnostics = _.flatMap(missing_files, n => {
return file_groups[n.key].map(f => {
return new vscode.Diagnostic(n.range, `TinyPg: SQL file [${n.key}] not found.`, vscode.DiagnosticSeverity.Error)
const missing_file_diagnostics = _.flatMap(file_groups, (missing, key) => {
return missing.map(m => {
return new vscode.Diagnostic(m.range, `TinyPg: SQL file [${key}] not found.`, vscode.DiagnosticSeverity.Error)
})
})

Expand Down
7 changes: 5 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ export async function collectTinyCallDetails(document: vscode.TextDocument): Pro
return null
}

const sql_call_key = (<ts.StringLiteral>call_expression.arguments[0]).text
const sql_call_range = new vscode.Range(document.positionAt(call_expression.pos), document.positionAt(call_expression.end))
const sql_call_key = (<ts.StringLiteralLike>call_expression.arguments[0]).text
const sql_call_range = new vscode.Range(
document.positionAt(call_expression.arguments[0].pos),
document.positionAt(call_expression.arguments[0].end)
)

const getObjectLiteralProperties = () => {
if (call_expression.arguments[1].kind !== ts.SyntaxKind.ObjectLiteralExpression) {
Expand Down
9 changes: 4 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit b736df4

Please sign in to comment.