我正在尝试编写一个简单的模板变量解析器扩展,该扩展名现在应该仅插入随机UUID,但是由于某些原因,当我在“首选项”菜单中的模板定义中单击“插入变量”时,我的变量未显示在列表中在Java->编辑器->模板下。
我认为我需要以某种方式注册解析器类,但是我没有在线找到表明我需要这样做的信息。
我有一个插件项目,它显示在Eclipse中已安装插件的列表中。
我的解析器扩展了SimpleTemplateVariableResolver,看起来像这样:
const gulp = require("gulp");
const {series} = require('gulp');
const ts = require("gulp-typescript");
const gulpNodeWatch = require('gulp-nodemon');
const serverSourceFiles = 'app/**/*.ts'
const ServerDestination = {
dir: 'server',
entryPoint: 'server/index.js'
};
async function transpile() {
return await gulp.src(serverSourceFiles)
.pipe(ts({
noImplicitAny: false,
importHelpers: true,
sourceMap: true,
declaration: false,
moduleResolution: "node",
emitDecoratorMetadata: true,
experimentalDecorators: true,
target: "es5",
lib: [
"es2015",
"dom"
],
typeRoots: [
"node_modules/@types"
],
}))
.pipe(gulp.dest(ServerDestination.dir));
}
async function runServer() {
return await gulpNodeWatch({
script: ServerDestination.entryPoint,
ext: 'ts',
watch: serverSourceFiles,
stdout: true,
readable: false,
quiet: false,
tasks: ['transpile']
});
}
exports.transpile = transpile;
exports.default = series(runServer, transpile);
我已经在plugin.xml中添加了扩展点,
public class UUIDTemplateVariableResolver extends SimpleTemplateVariableResolver {
protected UUIDTemplateVariableResolver() {
super("randomuuid", "Get random UUID");
}
/** {@inheritDoc} */
@Override
protected String resolve(final TemplateContext context) {
return UUID.randomUUID().toString();
}
}
我想念什么?