欢迎去往我的github

3.实现代码提示

笔记软件在2023/4/1 12:20:32推送该笔记

定义命令(package.json)

"activationEvents": [
		"onLanguage:soildity"
	],
	"main": "./extension.js",
    "contributes": {
        "languages": [{
            "id": "soildity",
            "aliases": ["soildity", "sol"],
            "extensions": [".sol"],
            "configuration": "./language-configuration.json"
        }],
        "grammars": [{
            "language": "soildity",
            "scopeName": "source.soildity",
            "path": "./syntaxes/soildity.tmLanguage.json"
        }]
    },

activate下添加(extension.js)

const {CompletionItemKind,TextDocument,Position,CancellationToken,CompletionContext} = vscode

vscode.languages.registerCompletionItemProvider('soildity', {
		provideCompletionItems(document, position, token, context) {
			return [
				{
					detail: "我很好看",
					kind: CompletionItemKind.Constant,
					label: "reason"
				},{
					detail: "我不好看",
					kind: CompletionItemKind.Constant,
					label: "reason"
				},{
					detail: "我很好看",
					kind: CompletionItemKind.Constant,
					label: "reason"
				}
			]
		}
	}," ",);

posted @ 2023-04-01 12:21  月夜魂归  阅读(11)  评论(0编辑  收藏  举报
……