Skip to content

Commit

Permalink
add resolveModuleReferences as property
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Dec 9, 2021
1 parent 57824ae commit 6e64249
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/cssLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function getCSSLanguageService(options: LanguageServiceOptions = defaultL
new Parser(),
new CSSCompletion(null, options, cssDataManager),
new CSSHover(options && options.clientCapabilities, cssDataManager),
new CSSNavigation(options && options.fileSystemProvider),
new CSSNavigation(options && options.fileSystemProvider, false),
new CSSCodeActions(cssDataManager),
new CSSValidation(cssDataManager),
cssDataManager
Expand All @@ -132,7 +132,7 @@ export function getLESSLanguageService(options: LanguageServiceOptions = default
new LESSParser(),
new LESSCompletion(options, cssDataManager),
new CSSHover(options && options.clientCapabilities, cssDataManager),
new CSSNavigation(options && options.fileSystemProvider),
new CSSNavigation(options && options.fileSystemProvider, true),
new CSSCodeActions(cssDataManager),
new CSSValidation(cssDataManager),
cssDataManager
Expand Down
4 changes: 2 additions & 2 deletions src/services/cssNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const startsWithData = /^data:/;

export class CSSNavigation {

constructor(protected fileSystemProvider: FileSystemProvider | undefined) {
constructor(protected fileSystemProvider: FileSystemProvider | undefined, private readonly resolveModuleReferences: boolean) {
}

public findDefinition(document: TextDocument, position: Position, stylesheet: nodes.Node): Location | null {
Expand Down Expand Up @@ -322,7 +322,7 @@ export class CSSNavigation {
// and [sass-loader's](https://github.com/webpack-contrib/sass-loader#resolving-import-at-rules)
// new resolving import at-rules (~ is deprecated). The loader will first try to resolve @import as a relative path. If it cannot be resolved,
// then the loader will try to resolve @import inside node_modules.
if (documentUri.endsWith('.less') || documentUri.endsWith('.scss') || documentUri.endsWith('.sass')) {
if (this.resolveModuleReferences) {
if (relativeReference && await this.fileExists(relativeReference)) {
return relativeReference;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/services/scssNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { startsWith } from '../utils/strings';

export class SCSSNavigation extends CSSNavigation {
constructor(fileSystemProvider: FileSystemProvider | undefined) {
super(fileSystemProvider);
super(fileSystemProvider, true);
}

protected isRawStringDocumentLinkNode(node: nodes.Node): boolean {
Expand Down

0 comments on commit 6e64249

Please sign in to comment.