Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1845: Extended the LSP with the semantic highlighting capabilities. #2332

Merged
merged 1 commit into from
Aug 8, 2018

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Jul 10, 2018

Closes #1845

Signed-off-by: Akos Kitta kittaakos@typefox.io

protected readonly disposables: Disposable[] = [];
protected readonly onDisposeEmitter = new Emitter<void>();

constructor(toDispose?: Disposable | Disposable[]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea! How about using varargs?

constructor(...disposables: Disposable[]) {
    this.pushAll(disposables);
}

}

@injectable()
export class NoopSemanticHighlightingService implements SemanticHighlightingService {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about turning SemanticHighlightingService into a class and use it as no-op implementation to get rid of additional symbol, inteface and bindings? Similary to QuickOpenService.

package.json Outdated
@@ -23,6 +23,7 @@
"chai-string": "^1.4.0",
"concurrently": "^3.5.0",
"electron-mocha": "~3.5.0",
"esm": "^3.0.72",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove this.

import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate';

@injectable()
export class JavaTextmateContribution implements LanguageGrammarDefinitionContribution {

// TODO: restore this!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO!!!

* - `from` can be greater than `to`. If so, the arguments will be swapped internally and you still get back `[to, to + 1, ..., from -1, from]`
* - If `from` and `to` are the same, returns with a single element range: `[from]`.
*/
protected rangeOf(from: number, to: number): number[] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove this.


}

// /**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: clean this up.

@kittaakos kittaakos force-pushed the GH-1845 branch 2 times, most recently from 18450e9 to ceb74d2 Compare August 1, 2018 11:11
const downloadURI = packageJson['ls.download.base'] || 'https://www.eclipse.org/downloads/download.php?file=';
const archiveUri = downloadURI + serverPath + '&r=1';
// TODO revert this!
const serverPath = 'https://github.com/kittaakos/eclipse.jdt.ls-gh-715/raw/master/jdt-language-server-latest.tar.gz';//packageJson['ls.download.path'] || '/che/che-ls-jdt/snapshots/che-jdt-language-server-latest.tar.gz';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: It is a hack. Revert this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { Disposable } from '@theia/core/lib/common/disposable';

@injectable()
export class SemanticHighlightingService implements Disposable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add some comment, explaining why this impl is entirely empty. It's ok to have a pointer to the monaco implementation in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move the entire implementation from @theia/monaco to @theia/editor if I can expose the id property for the editor decoration.

The API for the EditorDecoration lacks this information.

}

/**
* We do not get delta notification from the LS if lines were deleted and new semantic highlighting positions were introduced.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we talked about it, but I forget why that is. I think it should be the responsibility of the LS to send updates in that case, too.

* @param id The decoration id.
* @return The decoration range or `undefined` if the decoration was not found.
*/
getDecorationRange(id: string): Range | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any clients for this.

Copy link
Contributor

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Looks very good to me :)
I noticed that neither in Java neither static members were italic (didn't notice a difference) nor were deprecated underlined (they are turned red and italic)

@svenefftinge
Copy link
Contributor

Ah, no sorry, static fields are italic but methods not.

screen shot 2018-08-06 at 09 18 34

screen shot 2018-08-06 at 09 16 49

@kittaakos
Copy link
Contributor Author

Ah, no sorry, static fields are italic but methods not.

Static method declarations are not, static method invocations are italic. Just like in Eclipse with JDT.

@kittaakos kittaakos force-pushed the GH-1845 branch 4 times, most recently from bb86112 to c1f5c6d Compare August 6, 2018 17:03
@kittaakos kittaakos changed the title [WIP] GH-1845: Extended the LSP with the semantic highlighting capabilities. GH-1845: Extended the LSP with the semantic highlighting capabilities. Aug 7, 2018
@kittaakos kittaakos force-pushed the GH-1845 branch 2 times, most recently from 5bd6956 to 0fb4300 Compare August 7, 2018 12:52
Copy link
Contributor

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kittaakos
Copy link
Contributor Author

I would like to check the Windows failure before merging this.

@kittaakos
Copy link
Contributor Author

Bumping the test timeout fixed the issue. I do one more squash and build, then I merge this.

Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>

import { injectable } from 'inversify';
import { Argv, Arguments } from 'yargs';
import { CliContribution } from '@theia/core/src/node/cli';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src -> lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants