Skip to content

Commit

Permalink
fix(language): set custom language back to override html and disable …
Browse files Browse the repository at this point in the history
…custom hover, resolves #45
  • Loading branch information
Erik Lieben committed May 4, 2017
1 parent d93039e commit 4048c8d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 82 deletions.
59 changes: 0 additions & 59 deletions dist/src/client/relatedFiles.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/src/client/relatedFiles.js.map

This file was deleted.

30 changes: 23 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"Snippets"
],
"activationEvents": [
"onLanguage:aurelia-html",
"onLanguage:html",
"onCommand:extension.auNew",
"onCommand:extension.auGenerate",
"onCommand:extension.auTest",
Expand All @@ -46,24 +46,40 @@
"contributes": {
"languages": [
{
"id": "aurelia-html",
"id": "html",
"order": 1,
"extensions": [
".html"
".html",
".htm",
".shtml",
".xhtml",
".mdoc",
".jsp",
".asp",
".aspx",
".jshtm",
".volt",
".ejs"
],
"aliases": [
"Aurelia HTML",
"html"
"HTML",
"htm",
"html",
"xhtml"
],
"mimetypes": [
"text/html"
"text/html",
"text/x-jshtm",
"text/template",
"text/ng-template",
"application/xhtml+xml"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "aurelia-html",
"language": "html",
"scopeName": "au.html",
"path": "./syntaxes/html.json"
}
Expand Down
6 changes: 3 additions & 3 deletions src/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function activate(context: ExtensionContext) {
// Register code fix
const invalidCasingAction = new htmlInvalidCasingActionProvider();
invalidCasingAction.activate(context.subscriptions);
languages.registerCodeActionsProvider('aurelia-html', invalidCasingAction);
languages.registerCodeActionsProvider('html', invalidCasingAction);

// Register Aurelia language server
const serverModule = context.asAbsolutePath(path.join('dist', 'src', 'server', 'main.js'));
Expand All @@ -32,14 +32,14 @@ export function activate(context: ExtensionContext) {

const clientOptions: LanguageClientOptions = {
diagnosticCollectionName: 'Aurelia',
documentSelector: ['aurelia-html'],
documentSelector: ['html'],
initializationOptions: {},
synchronize: {
configurationSection: ['aurelia'],
},
};

const client = new LanguageClient('aurelia-html', 'Aurelia', serverOptions, clientOptions);
const client = new LanguageClient('html', 'Aurelia', serverOptions, clientOptions);
const disposable = client.start();
context.subscriptions.push(disposable);
}
2 changes: 1 addition & 1 deletion src/server/HoverProviderFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class HoverProviderFactory {

return {
contents: [
{ language: 'aurelia-html', value: displayValue },
{ language: 'html', value: displayValue },
{ language: 'markdown', value: documentation },
moreInfo,
source
Expand Down
11 changes: 0 additions & 11 deletions src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { HTMLDocument, getLanguageService } from './aurelia-languageservice/aure
import { getLanguageModelCache } from './languageModelCache';
import { Container } from 'aurelia-dependency-injection';
import CompletionItemFactory from './CompletionItemFactory';
import HoverProviderFactory from './HoverProviderFactory';
import ElementLibrary from './Completions/Library/_elementLibrary';
import AureliaSettings from './AureliaSettings';

Expand All @@ -29,7 +28,6 @@ connection.onShutdown(() => htmlDocuments.dispose());
// Setup Aurelia dependency injection
let globalContainer = new Container();
let completionItemFactory = <CompletionItemFactory> globalContainer.get(CompletionItemFactory);
let hoverProviderFactory = <HoverProviderFactory> globalContainer.get(HoverProviderFactory);

// Register characters to lisen for
connection.onInitialize((params: InitializeParams): InitializeResult => {
Expand All @@ -40,7 +38,6 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
return {
capabilities: {
completionProvider: { resolveProvider: false, triggerCharacters: ['<', ' ', '.', '[', '"', '\''] },
hoverProvider: true,
textDocumentSync: documents.syncKind,
},
};
Expand Down Expand Up @@ -70,12 +67,4 @@ connection.onCompletion(textDocumentPosition => {
return completionItemFactory.create(triggerCharacter, position, text, offset, textDocumentPosition.textDocument.uri);
});

connection.onHover(textDocumentPosition => {
let document = documents.get(textDocumentPosition.textDocument.uri);
let text = document.getText();
let offset = document.offsetAt(textDocumentPosition.position);

return hoverProviderFactory.create(text, offset);
});

connection.listen();

0 comments on commit 4048c8d

Please sign in to comment.