This repository has been archived by the owner on Jun 20, 2018. It is now read-only.
forked from eclipse-theia/theia
-
Notifications
You must be signed in to change notification settings - Fork 0
Theia plugin metadata #1
Merged
akurinnoy
merged 9 commits into
theia-demo-plugins:master
from
akurinnoy:theia-plugin-metadata
Apr 20, 2018
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4e007f1
rename and update pluginPackage and pluginModel
akurinnoy 89af03b
re-vamp scanners for plugin's metadata
akurinnoy 563c942
provide lifecycle metadata to the plugin
akurinnoy 01bfa58
stop plugins by ID
akurinnoy 4536d5f
remove context from plugin's lifecycle
akurinnoy 77b0cd4
get frontend plugin name from lifecycle metadata
akurinnoy abe3edb
make plugin system more pluggable
akurinnoy 369b469
fixup! make plugin system more pluggable
akurinnoy 3b04d3f
Merge branch 'master' of github.com:theia-demo-plugins/wiptheia into …
akurinnoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2015-2018 Red Hat, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import { BackendInitializationFn } from '../../common/plugin-protocol'; | ||
import { createAPI } from '../../plugin/plugin-context'; | ||
|
||
export const doInitialization: BackendInitializationFn = (rpc: any) => { | ||
const theia = createAPI(rpc); | ||
|
||
// add theia into global goal | ||
const g = global as any; | ||
g['theia'] = theia; | ||
|
||
const NODE_MODULE_NAMES = ['@theia/plugin', '@wiptheia/plugin']; | ||
const module = require('module'); | ||
|
||
// add theia object as module into npm cache | ||
NODE_MODULE_NAMES.forEach(moduleName => { | ||
require.cache[moduleName] = { | ||
id: moduleName, | ||
filename: moduleName, | ||
loaded: true, | ||
exports: theia | ||
}; | ||
}); | ||
|
||
// save original resolve method | ||
const internalResolve = module._resolveFilename; | ||
|
||
// if we try to resolve theia module, return the filename entry to use cache. | ||
module._resolveFilename = (request: string, parent: {}) => { | ||
if (NODE_MODULE_NAMES.indexOf(request) !== -1) { | ||
return request; | ||
} | ||
const retVal = internalResolve(request, parent); | ||
return retVal; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2018 Red Hat, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import { BackendInitializationFn } from '../../common/plugin-protocol'; | ||
import { createAPI } from '../../plugin/plugin-context'; | ||
|
||
export const doInitialization: BackendInitializationFn = (rpc: any) => { | ||
const module = require('module'); | ||
const vscodeModuleName = 'vscode'; | ||
const theia = createAPI(rpc); | ||
|
||
// add theia into global goal as 'vscode' | ||
const g = global as any; | ||
g[vscodeModuleName] = theia; | ||
|
||
// add vscode object as module into npm cache | ||
require.cache[vscodeModuleName] = { | ||
id: vscodeModuleName, | ||
filename: vscodeModuleName, | ||
loaded: true, | ||
exports: g[vscodeModuleName] | ||
}; | ||
|
||
// save original resolve method | ||
const internalResolve = module._resolveFilename; | ||
|
||
// if we try to resolve vscode module, return the filename entry to use cache. | ||
module._resolveFilename = (request: string, parent: {}) => { | ||
if (vscodeModuleName === request) { | ||
return request; | ||
} | ||
const retVal = internalResolve(request, parent); | ||
return retVal; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is contributes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's added for future use. It is an object which describes contribution points of a plugin.