Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
import { EditorManager } from 'theia-core/lib/editor/browser'
import { TextDocumentPositionParams, Location } from 'vscode-base-languageclient/lib/services'
import { DiagramConfigurationRegistry } from './diagram-configuration'
import { TYPES } from 'sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { LanguageClientContribution } from 'theia-core/lib/languages/browser'
import { injectable, inject } from "inversify"
import URI from "theia-core/lib/application/common/uri"
const actionMessageType = new NotificationType('diagram/onAction')
const openInTextEditorType = new NotificationType('diagram/openInTextEditor')
const textPositionMessageType = new NotificationType('diagram/update')
@injectable()
export class TheiaDiagramServerConnector {
private servers: TheiaDiagramServer[] = []
constructor(@inject(LanguageClientContribution) private languageClientContribution: LanguageClientContribution,
@inject(DiagramConfigurationRegistry) private diagramConfigurationRegistry: DiagramConfigurationRegistry,
@inject(EditorManager) private editorManager: EditorManager) {
this.languageClientContribution.languageClient.then(
lc => {
lc.onNotification(actionMessageType, this.actionMessageReceived.bind(this))
lc.onNotification(openInTextEditorType, this.openInTextEditorReceived.bind(this))
}
).catch(
err => console.error(err)
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import { DiagramWidgetRegistry } from '../theia/diagram-widget-registry'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
export interface TheiaSprottyConnector {
connect(diagramServer: TheiaDiagramServer): void
disconnect(diagramServer: TheiaDiagramServer): void
save(uri: string, action: ExportSvgAction): void
openInTextEditor(message: OpenInTextEditorMessage): void
showStatus(widgetId: string, status: ServerStatusAction): void
sendMessage(message: ActionMessage): void
onMessageReceived(message: ActionMessage): void
}
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through
* the LSP.
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types/lib/main'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through
* the LSP.
*
* Instances bridge the gap between the sprotty DI containers (one per
* diagram) and a specific language client from the Theia DI container
* (one per application).
*/
export class TheiaSprottyConnector {
private servers: TheiaDiagramServer[] = []
constructor(private languageClientContribution: LanguageClientContribution,
import { ActionMessage, ExportSvgAction } from 'sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types/lib/main'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through
* the LSP.
*
* Instances bridge the gap between the sprotty DI containers (one per
* diagram) and a specific language client from the Theia DI container
* (one per application).
*/
export class TheiaSprottyConnector {
private servers: TheiaDiagramServer[] = []
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import { DiagramWidgetRegistry } from '../theia/diagram-widget-registry'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
export interface TheiaSprottyConnector {
connect(diagramServer: TheiaDiagramServer): void
disconnect(diagramServer: TheiaDiagramServer): void
save(uri: string, action: ExportSvgAction): void
openInTextEditor(message: OpenInTextEditorMessage): void
showStatus(widgetId: string, status: ServerStatusAction): void
sendMessage(message: ActionMessage): void
onMessageReceived(message: ActionMessage): void
}
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through
* the LSP.
*
import { ActionMessage, ExportSvgAction } from 'sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types/lib/main'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through
* the LSP.
*
* Instances bridge the gap between the sprotty DI containers (one per
* diagram) and a specific language client from the Theia DI container
* (one per application).
*/
export class TheiaSprottyConnector {
private servers: TheiaDiagramServer[] = []
*
* Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
import { EditorManager } from 'theia-core/lib/editor/browser'
import { TextDocumentPositionParams, Location } from 'vscode-base-languageclient/lib/services'
import { DiagramConfigurationRegistry } from './diagram-configuration'
import { TYPES } from 'sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { LanguageClientContribution } from 'theia-core/lib/languages/browser'
import { injectable, inject } from "inversify"
import URI from "theia-core/lib/application/common/uri"
const actionMessageType = new NotificationType('diagram/onAction')
const openInTextEditorType = new NotificationType('diagram/openInTextEditor')
const textPositionMessageType = new NotificationType('diagram/update')
@injectable()
export class TheiaDiagramServerConnector {
private servers: TheiaDiagramServer[] = []
constructor(@inject(LanguageClientContribution) private languageClientContribution: LanguageClientContribution,
@inject(DiagramConfigurationRegistry) private diagramConfigurationRegistry: DiagramConfigurationRegistry,
@inject(EditorManager) private editorManager: EditorManager) {
this.languageClientContribution.languageClient.then(
lc => {
lc.onNotification(actionMessageType, this.actionMessageReceived.bind(this))
lc.onNotification(openInTextEditorType, this.openInTextEditorReceived.bind(this))
}
* Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
import { EditorManager } from 'theia-core/lib/editor/browser'
import { TextDocumentPositionParams, Location } from 'vscode-base-languageclient/lib/services'
import { DiagramConfigurationRegistry } from './diagram-configuration'
import { TYPES } from 'sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { LanguageClientContribution } from 'theia-core/lib/languages/browser'
import { injectable, inject } from "inversify"
import URI from "theia-core/lib/application/common/uri"
const actionMessageType = new NotificationType('diagram/onAction')
const openInTextEditorType = new NotificationType('diagram/openInTextEditor')
const textPositionMessageType = new NotificationType('diagram/update')
@injectable()
export class TheiaDiagramServerConnector {
private servers: TheiaDiagramServer[] = []
constructor(@inject(LanguageClientContribution) private languageClientContribution: LanguageClientContribution,
@inject(DiagramConfigurationRegistry) private diagramConfigurationRegistry: DiagramConfigurationRegistry,
@inject(EditorManager) private editorManager: EditorManager) {
this.languageClientContribution.languageClient.then(
lc => {
lc.onNotification(actionMessageType, this.actionMessageReceived.bind(this))
lc.onNotification(openInTextEditorType, this.openInTextEditorReceived.bind(this))
}
).catch(
import { ActionMessage, ExportSvgAction, ServerStatusAction } from 'glsp-sprotty/lib'
import { TheiaDiagramServer } from './theia-diagram-server'
import { NotificationType } from 'vscode-jsonrpc/lib/messages'
import { Location } from 'vscode-languageserver-types'
import { LanguageClientContribution } from '@theia/languages/lib/browser'
import { EditorManager } from '@theia/editor/lib/browser'
import { TheiaFileSaver } from './theia-file-saver'
import { DiagramWidgetRegistry } from '../theia/diagram-widget-registry'
import URI from "@theia/core/lib/common/uri"
export interface OpenInTextEditorMessage {
location: Location
forceOpen: boolean
}
const acceptMessageType = new NotificationType('diagram/accept')
const didCloseMessageType = new NotificationType('diagram/didClose')
const openInTextEditorMessageType = new NotificationType('diagram/openInTextEditor')
export interface TheiaSprottyConnector {
connect(diagramServer: TheiaDiagramServer): void
disconnect(diagramServer: TheiaDiagramServer): void
save(uri: string, action: ExportSvgAction): void
openInTextEditor(message: OpenInTextEditorMessage): void
showStatus(widgetId: string, status: ServerStatusAction): void
sendMessage(message: ActionMessage): void
onMessageReceived(message: ActionMessage): void
}
/**
* Connects sprotty DiagramServers to a Theia LanguageClientContribution.
*
* Used to tunnel sprotty actions to and from the sprotty server through