Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Improve wording, rename helper class
Browse files Browse the repository at this point in the history
  • Loading branch information
lggomez committed Jul 29, 2018
1 parent 19c8961 commit 775752f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/goSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export class GoSignatureHelpProvider implements SignatureHelpProvider {
return null;
}

private getStringLiteralIndexes(currentLine: string): IndexRangeArray {
private getStringLiteralIndexes(currentLine: string): PairedIndexWrapper {
// Index string literal boundaries
// This is needed to detect string literals and avoid pushing commas within them
let stringLiteralBoundaries = new IndexRangeArray();
let stringLiteralBoundaries = new PairedIndexWrapper();
let stringLiteralRegex = RegExp('([\`\'\"])(?:(?!(?:\\\\|\\1)).|\\\\.)*\\1', 'giu');
let m: RegExpExecArray | null = null;
do {
Expand All @@ -159,13 +159,14 @@ export class GoSignatureHelpProvider implements SignatureHelpProvider {
}

/*
* Array wrapper that contains indexes treated as pairs
* Array wrapper that contains indexes treated as pairs,
* assuming an increasing order (going foward)
* An odd number of elements will consider the last
* element as the start of a new (incomplete) range
*/
class IndexRangeArray {
class PairedIndexWrapper {
LastIndex: number;
Array: Array<number>;
private Array: Array<number>;

public constructor() {
this.Array = new Array<number>();
Expand All @@ -178,7 +179,7 @@ class IndexRangeArray {
}

// Traverse the index pairs contained in the array
// This assumes a forward (increasing) order
// and check whether an index is inside a pair or not
public IsWithinPairRange(index: number): boolean {
let isEven = (this.Array.length % 2) === 0;
if (index > this.LastIndex) return !isEven;
Expand Down

0 comments on commit 775752f

Please sign in to comment.