-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-1845: Extended the LSP with the semantic highlighting capabilities.
Closes #1845 Signed-off-by: Akos Kitta <kittaakos@typefox.io>
- Loading branch information
Akos Kitta
committed
Jul 18, 2018
1 parent
4ba93d6
commit 3419c3f
Showing
12 changed files
with
408 additions
and
33 deletions.
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
39 changes: 39 additions & 0 deletions
39
packages/editor/src/browser/semantic-highlight/semantic-highlighting-service.ts
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,39 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 TypeFox and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { injectable } from 'inversify'; | ||
import { Position, Range } from 'vscode-languageserver-types'; | ||
import URI from '@theia/core/lib/common/uri'; | ||
import { Disposable } from '@theia/core/lib/common/disposable'; | ||
|
||
@injectable() | ||
export class SemanticHighlightingService implements Disposable { | ||
|
||
async decorate(uri: URI, ranges: SemanticHighlightingRange[]): Promise<void> { | ||
// NOOP | ||
} | ||
|
||
dispose(): void { | ||
// NOOP | ||
} | ||
|
||
} | ||
|
||
export interface SemanticHighlightingRange extends Range { | ||
readonly scopes: string[]; | ||
} | ||
|
||
export { Position, Range }; |
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
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,58 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 TypeFox and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { injectable } from 'inversify'; | ||
import { Argv, Arguments } from 'yargs'; | ||
import { CliContribution } from '@theia/core/src/node/cli'; | ||
|
||
@injectable() | ||
export class JavaCliContribution implements CliContribution { | ||
|
||
private static LS_PORT = 'java-ls'; | ||
|
||
protected _lsPort: number | undefined; | ||
|
||
configure(conf: Argv): void { | ||
conf.option(JavaCliContribution.LS_PORT, { | ||
description: 'Can be specified if the backend should not start the Java LS process but create a socket server and wait until the Java LS connects.', | ||
type: 'number', | ||
nargs: 1 | ||
}); | ||
} | ||
|
||
setArguments(args: Arguments): void { | ||
this.setLsPort(args[JavaCliContribution.LS_PORT]); | ||
} | ||
|
||
lsPort(): number | undefined { | ||
return this._lsPort; | ||
} | ||
|
||
// tslint:disable-next-line:no-any | ||
protected setLsPort(port: any): void { | ||
if (port !== undefined) { | ||
const error = new Error(`The port for the Java LS must be an integer between 1 and 65535. It was: ${port}.`); | ||
if (!Number.isInteger(port)) { | ||
throw error; | ||
} | ||
if (port < 1 || port > 65535) { | ||
throw error; | ||
} | ||
this._lsPort = port; | ||
} | ||
} | ||
|
||
} |
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.