Skip to content

Commit f86d093

Browse files
author
Dyhagho Briceño
authored
[scss] Path resolver to include partial files support (#373)
* Support partials on path resolver * Inline SCSS extension removal in target URI parsing
1 parent 8090d87 commit f86d093

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/services/scssNavigation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export class SCSSNavigation extends CSSNavigation {
4444
}
4545

4646
function toPathVariations(target: string): DocumentUri[] {
47-
// No variation for links that ends with suffix
48-
if (target.endsWith('.scss') || target.endsWith('.css')) {
47+
// No variation for links that ends with .css suffix
48+
if (target.endsWith('.css')) {
4949
return [target];
5050
}
5151

@@ -54,7 +54,7 @@ function toPathVariations(target: string): DocumentUri[] {
5454
return [target + 'index.scss', target + '_index.scss'];
5555
}
5656

57-
const targetUri = URI.parse(target);
57+
const targetUri = URI.parse(target.replace(/\.scss$/, ''));
5858
const basename = Utils.basename(targetUri);
5959
const dirname = Utils.dirname(targetUri);
6060
if (basename.startsWith('_')) {

src/test/scss/scssNavigation.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ suite('SCSS - Navigation', () => {
154154
{ range: newRange(8, 13), target: getDocumentUri('./underscore/_foo.scss') }
155155
]);
156156

157+
await assertDynamicLinks(getDocumentUri('./underscore/index.scss'), `@import 'foo.scss'`, [
158+
{ range: newRange(8, 18), target: getDocumentUri('./underscore/_foo.scss') }
159+
]);
160+
157161
await assertDynamicLinks(getDocumentUri('./both/index.scss'), `@import 'foo'`, [
158162
{ range: newRange(8, 13), target: getDocumentUri('./both/foo.scss') }
159163
]);

0 commit comments

Comments
 (0)