Commit 6f1128a1 authored by tom's avatar tom

highlight absolute imports

parent 84fc5da9
......@@ -8,7 +8,7 @@ export default function addFileImportDecorations(model: monaco.editor.ITextModel
},
};
const regularImportMatches = model.findMatches('^import (\'|")((\\/|\\.).+)(\'|")', false, true, false, null, true);
const regularImportMatches = model.findMatches('^import (\'|")(.+)(\'|")', false, true, false, null, true);
const regularImportDecorations: Array<monaco.editor.IModelDeltaDecoration> = regularImportMatches.map(({ range }) => ({
range: {
...range,
......@@ -18,7 +18,7 @@ export default function addFileImportDecorations(model: monaco.editor.ITextModel
options,
}));
const namedImportMatches = model.findMatches('(^import \\{.+\\} from )(\'|")((\\/|\\.).+)(\'|")', false, true, false, null, true);
const namedImportMatches = model.findMatches('(^import \\{.+\\} from )(\'|")(.+)(\'|")', false, true, false, null, true);
const namedImportDecorations: Array<monaco.editor.IModelDeltaDecoration> = namedImportMatches.map(({ range, matches }) => ({
range: {
...range,
......
import stripLeadingSlash from 'lib/stripLeadingSlash';
export default function getFullPathOfImportedFile(baseFilePath: string, importedFilePath: string) {
if (importedFilePath[0] === '/') {
return importedFilePath;
}
if (importedFilePath[0] !== '.') {
return;
return importedFilePath[0] === '/' ? importedFilePath : '/' + importedFilePath;
}
const baseFileChunks = stripLeadingSlash(baseFilePath).split('/');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment