Skip to content

Commit

Permalink
change require to import statement
Browse files Browse the repository at this point in the history
  • Loading branch information
hereistheusername committed Jul 7, 2024
1 parent b9775a3 commit 866a091
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { commands, ExtensionContext, window } from 'vscode';
import { commands, ExtensionContext, window, workspace, Uri } from 'vscode';
import { isMdEditor } from '../../utils';
import { Foam } from '../../core/model/foam';
import { FoamWorkspace } from '../../core/model/workspace';
import { fromVsCodeUri, toVsCodeRange } from '../../utils/vsc-utils';
import { ResourceParser } from '../../core/model/note';
import { IMatcher } from '../../core/services/datastore';
import { convertLinkFormat } from '../../core/janitor';
const vscode = require('vscode'); /* cannot import workspace from above statement and not sure what happened */

type LinkFormat = 'wikilink' | 'link';

Expand Down Expand Up @@ -176,13 +175,13 @@ async function convertLinkInCopy(
const resource = fParser.parse(fromVsCodeUri(doc.uri), text);
const basePath = doc.uri.path.split('/').slice(0, -1).join('/');

const fileUri = vscode.Uri.file(
const fileUri = Uri.file(
`${
basePath ? basePath + '/' : ''
}${resource.uri.getName()}.copy${resource.uri.getExtension()}`
);
const encoder = new TextEncoder();
await vscode.workspace.fs.writeFile(fileUri, encoder.encode(text));
await workspace.fs.writeFile(fileUri, encoder.encode(text));
await window.showTextDocument(fileUri);

await convertLinkInPlace(fWorkspace, fParser, fMatcher, convertOption);
Expand Down

0 comments on commit 866a091

Please sign in to comment.