Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #15 from coveo/code_completion
Browse files Browse the repository at this point in the history
Code completion #3
  • Loading branch information
André Thériault authored Jul 7, 2016
2 parents b1c05ff + 2428c2f commit b7be26f
Show file tree
Hide file tree
Showing 13 changed files with 6,291 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"onLanguage:apex",
"onLanguage:visualforce"
],
"main": "./out/src/extension",
"main": "./out/src/vsforce",
"contributes": {
"commands": [
{
Expand Down
5 changes: 5 additions & 0 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import * as vscode from 'vscode';
import * as xml2js from 'xml2js';
import * as fs from 'fs';

export interface QueryResult {
totalSize: number,
records: any[]
}

export class Connection {
private jsforceConn: any;
private outputConsole: vscode.OutputChannel;
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Connection} from './connection'
let jsforce = require('jsforce');
let fs = require('fs');
var zipFolder = require('zip-folder');

/*
export function activate(context: vscode.ExtensionContext) {
var conn = new Connection();
Expand Down Expand Up @@ -55,7 +55,7 @@ export function activate(context: vscode.ExtensionContext) {
});
});
}

*/
// this method is called when your extension is deactivated
export function deactivate() {
}
27 changes: 27 additions & 0 deletions src/providers/visualforceComponentCIP.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import vscode = require('vscode')
import {VisualforceComponentCacheInstance} from '../symbols/visualforceComponentCache'

export class VisualforceCompletionItemProvider implements vscode.CompletionItemProvider {
public constructor() {
vscode.languages.setLanguageConfiguration("visualforce", {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\'\"\,\.\<\>\/\?\s]+)/g
});
}

public provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable<vscode.CompletionItem[]> {
return new Promise<vscode.CompletionItem[]>((resolve, reject) => {
var completionItems: vscode.CompletionItem[] = [];

VisualforceComponentCacheInstance.getComponentNames().forEach(cmp => {
var completionItem = new vscode.CompletionItem(cmp);
completionItem.kind = vscode.CompletionItemKind.Class;
completionItem.insertText = completionItem.label + "></" + completionItem.label + ">";

completionItems.push(completionItem);
});
resolve(completionItems);
});
}
}


Loading

0 comments on commit b7be26f

Please sign in to comment.