Skip to content

Commit

Permalink
fix(providers): return back local symbols suggestion for Hover & Sign…
Browse files Browse the repository at this point in the history
…atureHelp
  • Loading branch information
mrmlnc committed Dec 1, 2019
1 parent 6bdd703 commit c8049a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/providers/hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ISymbols, IVariable, IMixin, IFunction } from '../types/symbols';
import StorageService from '../services/storage';

import { parseDocument } from '../services/parser';
import { getSymbolsRelatedToDocument } from '../utils/symbols';
import { getSymbolsCollection } from '../utils/symbols';
import { getDocumentPath } from '../utils/document';
import { getLimitedString } from '../utils/string';

Expand Down Expand Up @@ -145,7 +145,7 @@ export function doHover(document: TextDocument, offset: number, storage: Storage

storage.set(documentPath, resource.symbols);

const symbolsList = getSymbolsRelatedToDocument(storage, documentPath);
const symbolsList = getSymbolsCollection(storage);
const documentImports = resource.symbols.imports.map(x => x.filepath);
const symbol = getSymbol(symbolsList, identifier, documentPath);

Expand Down
4 changes: 2 additions & 2 deletions src/providers/signatureHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IVariable } from '../types/symbols';
import StorageService from '../services/storage';

import { parseDocument } from '../services/parser';
import { getSymbolsRelatedToDocument } from '../utils/symbols';
import { getSymbolsCollection } from '../utils/symbols';
import { getTextBeforePosition } from '../utils/string';
import { hasInFacts } from '../utils/facts';

Expand Down Expand Up @@ -171,7 +171,7 @@ export function doSignatureHelp(document: TextDocument, offset: number, storage:

storage.set(documentPath, resource.symbols);

getSymbolsRelatedToDocument(storage, documentPath).forEach(symbols => {
getSymbolsCollection(storage).forEach(symbols => {
symbols[symbolType].forEach(symbol => {
if (entry.name === symbol.name && symbol.parameters.length >= entry.parameters) {
suggestions.push({
Expand Down
7 changes: 5 additions & 2 deletions src/test/providers/hover.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ function getHover(lines: string[]): Hover | null {
}

describe('Providers/Hover', () => {
it('should do not suggest local symbols', () => {
it('should suggest local symbols', () => {
const actual = getHover([
'$one: 1;',
'.a { content: $one|; }'
]);

assert.strictEqual(actual.contents, '');
assert.deepStrictEqual(actual.contents, {
language: 'scss',
value: '$one: 1;'
});
});

it('should suggest global variables', () => {
Expand Down

0 comments on commit c8049a5

Please sign in to comment.