Theia IDE CF-Manifest-YAML client - missing files

This commit is contained in:
BoykoAlex
2018-04-20 10:06:25 -04:00
parent 76f40bd9f8
commit 0f5282d26a
6 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { injectable, inject } from "inversify";
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
import { CommonMenus } from "@theia/core/lib/browser";
export const CfManifestYamlCommand = {
id: 'CfManifestYaml.command',
label: "Shows a message"
};
@injectable()
export class CfManifestYamlCommandContribution implements CommandContribution {
constructor(
@inject(MessageService) private readonly messageService: MessageService,
) { }
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(CfManifestYamlCommand, {
execute: () => this.messageService.info('Hello World!')
});
}
}
@injectable()
export class CfManifestYamlMenuContribution implements MenuContribution {
registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: CfManifestYamlCommand.id,
label: 'Say Hello'
});
}
}

View File

@@ -0,0 +1,3 @@
{
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-0.1.5-201803080105.jar"
}

View File

@@ -0,0 +1,34 @@
const fs = require('fs');
const path = require('path');
const download = require('download');
const PROPERTIES = require('./properties.json');
let fileExists = function(path) {
return new Promise((resolve, reject) => {
fs.access(path, fs.R_OK, error => {
resolve(!error || error.code !== 'ENOENT');
})
});
};
const serverDownloadUrl = PROPERTIES.jarUrl;
const serverHome = path.join(__dirname, 'server');
const localFileName = path.join(serverHome, 'cf-manifest-language-server.jar');
fileExists(localFileName).then(exists => {
if (!exists) {
console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`);
fileExists(serverHome)
.then(doesExist => { if (!doesExist) fs.mkdir(serverHome) })
.then(() => download(serverDownloadUrl))
.then(data => fs.writeFileSync(localFileName, data))
.then(() => fileExists(localFileName))
.then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) })
.then(() => console.log(`Successfully downloaded ${serverDownloadUrl}`));
}
});

View File

@@ -0,0 +1,33 @@
import { injectable, inject } from "inversify";
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
import { CommonMenus } from "@theia/core/lib/browser";
export const HelloWorldCommand = {
id: 'HelloWorld.command',
label: "Shows a message"
};
@injectable()
export class HelloWorldCommandContribution implements CommandContribution {
constructor(
@inject(MessageService) private readonly messageService: MessageService,
) { }
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(HelloWorldCommand, {
execute: () => this.messageService.info('Hello World!')
});
}
}
@injectable()
export class HelloWorldMenuContribution implements MenuContribution {
registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: HelloWorldCommand.id,
label: 'Say Hello'
});
}
}

View File

@@ -0,0 +1,19 @@
/**
* Generated using theia-extension-generator
*/
import { HelloWorldCommandContribution, HelloWorldMenuContribution } from './hello-world-contribution';
import {
CommandContribution,
MenuContribution
} from "@theia/core/lib/common";
import { ContainerModule } from "inversify";
export default new ContainerModule(bind => {
// add your contribution bindings here
bind(CommandContribution).to(HelloWorldCommandContribution);
bind(MenuContribution).to(HelloWorldMenuContribution);
});

View File

@@ -0,0 +1,10 @@
{
"extends": "../configs/base.tsconfig",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
},
"include": [
"src"
]
}