add def file support
This commit is contained in:
@@ -16,7 +16,7 @@ export function formatCdlFile(content: string): string {
|
||||
return formattedLines.join("\n")
|
||||
}
|
||||
|
||||
export function completionHandler(document: vscode.TextDocument, position: vscode.Position) {
|
||||
export function completionHandlerCdl(document: vscode.TextDocument, position: vscode.Position) {
|
||||
const linePrefix = document.lineAt(position).text.substring(0, position.character)
|
||||
const categories = ["MILL", "LATHE", "DRILL"]
|
||||
|
||||
@@ -31,6 +31,13 @@ export function completionHandler(document: vscode.TextDocument, position: vscod
|
||||
]
|
||||
}
|
||||
|
||||
if (linePrefix.endsWith("TOGGLE ")) {
|
||||
return [
|
||||
new vscode.CompletionItem("off", vscode.CompletionItemKind.TypeParameter),
|
||||
new vscode.CompletionItem("on", vscode.CompletionItemKind.TypeParameter)
|
||||
]
|
||||
}
|
||||
|
||||
if (linePrefix.endsWith("CATEGORY ")) {
|
||||
return categories.map(
|
||||
(cat) => new vscode.CompletionItem(cat, vscode.CompletionItemKind.TypeParameter)
|
||||
@@ -49,7 +56,7 @@ export function completionHandler(document: vscode.TextDocument, position: vscod
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function hoverHandler(document: vscode.TextDocument, position: vscode.Position) {
|
||||
export function hoverCdlHandler(document: vscode.TextDocument, position: vscode.Position) {
|
||||
const wordRange = document.getWordRangeAtPosition(position)
|
||||
const word = document.getText(wordRange)
|
||||
const text = document.getText()
|
||||
|
||||
Reference in New Issue
Block a user