Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "parameter-hints",
"displayName": "Parameter Hints",
"description": "Automatic parameter hints",
"version": "0.2.7",
"version": "0.2.8",
"preview": true,
"icon": "icon.png",
"repository": {
Expand Down Expand Up @@ -48,13 +48,15 @@
"description": "Enable Languages",
"default": [
"php",
"vue",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact"
],
"enum": [
"php",
"vue",
"javascript",
"typescript",
"javascriptreact",
Expand Down
66 changes: 16 additions & 50 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,61 +37,27 @@ function activate(context) {
}
timeout = setTimeout(() => {
if (editor && (isEnabled() || force)) {
if (languagesEnabled().includes("php") && editor.document.languageId === 'php') {
currentRunner = runner(phpRunner, editor, hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}

const runnerHints = hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}
})
}
}
if (languagesEnabled().includes("php") && editor.document.languageId === 'php') {
currentRunner = runner(phpRunner, editor, runnerHints )
} else if (languagesEnabled().includes("vue") && editor.document.languageId === 'vue') {
currentRunner = runner(typescriptRunner, editor, runnerHints)
} else if (languagesEnabled().includes("typescript") && editor.document.languageId === 'typescript') {
currentRunner = runner(typescriptRunner, editor, hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}

}
}, { language: ts.ScriptKind.TS })
currentRunner = runner(typescriptRunner, editor, runnerHints, { language: ts.ScriptKind.TS })
} else if (languagesEnabled().includes("typescriptreact") && editor.document.languageId === 'typescriptreact') {
currentRunner = runner(typescriptRunner, editor, hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}

}
}, { language: ts.ScriptKind.TSX })
currentRunner = runner(typescriptRunner, editor, runnerHints, { language: ts.ScriptKind.TSX })
} else if (languagesEnabled().includes("javascript") && editor.document.languageId === 'javascript') {
currentRunner = runner(typescriptRunner, editor, hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}

}
}, { language: ts.ScriptKind.JS })
currentRunner = runner(typescriptRunner, editor, runnerHints, { language: ts.ScriptKind.JS })
} else if (languagesEnabled().includes("javascriptreact") && editor.document.languageId === 'javascriptreact') {
currentRunner = runner(typescriptRunner, editor, hints => {
if (hints !== false && isEnabled()) {
if (hints.length) {
editor.setDecorations(hintDecorationType, hints);
} else {
editor.setDecorations(hintDecorationType, [new vscode.Range(0, 0, 0, 0)]);
}

}
}, { language: ts.ScriptKind.JSX })
currentRunner = runner(typescriptRunner, editor, runnerHints, { language: ts.ScriptKind.JSX })
}
}
}, time);
Expand Down