Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This caused all of the troubles #426

Closed
ghost opened this issue Jun 12, 2021 · 1 comment
Closed

This caused all of the troubles #426

ghost opened this issue Jun 12, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 12, 2021

For example, fs.js module:

export('absolute',
       'base',
       'copy',
       'copyTree',
       'directory',
       'extension',
       'isAbsolute', // non-standard/non-spec
       'isRelative', // non-standard/non-spec
       'join',
       'makeTree',
       'listDirectoryTree',
       'listTree',
       'normal',
       'open',
       'path',
       'Path',
       'read',
       'relative',
       'removeTree',
       'resolve',
       'write',
       'split',
       // previously in fs-base
       'canonical',
       'workingDirectory',
       'exists',
       'isDirectory',
       'isFile',
       'isReadable',
       'isWritable',
       'list',
       'makeDirectory',
       'move',
       'lastModified',
       'openRaw',
       'remove',
       'removeDirectory',
       'size',
       'touch',
       'symbolicLink',
       'hardLink',
       'readLink',
       'isLink',
       'same',
       'sameFilesystem',
       'iterate',
       'Permissions',
       'owner',
       'group',
       'changePermissions',
       'changeOwner',
       'changeGroup',
       'permissions');

Most IDE supports RequireJS but not CommonJS. All of them will fail to parse the above code, making code suggestion impossible.

Change the above to this:

exports.absolute = absolute;
exports.base = base;
exports.copy = copy;
exports.copyTree = copyTree;
exports.directory = directory;
exports.extension = extension;
exports.isAbsolute = isAbsolute; // non-standard/non-spec
exports.isRelative = isRelative; // non-standard/non-spec
exports.join = join;
exports.makeTree = makeTree;
exports.listDirectoryTree = listDirectoryTree;
exports.listTree = listTree;
exports.normal = normal;
exports.open = open;
exports.path = path;
exports.Path = Path;
exports.read = read;
exports.relative = relative;
exports.removeTree = removeTree;
exports.resolve = resolve;
exports.write = write;
exports.split = split;
// previously in fs-base
exports.canonical = canonical;
exports.workingDirectory = workingDirectory;
exports.exists = exists;
exports.isDirectory = isDirectory;
exports.isFile = isFile;
exports.isReadable = isReadable;
exports.isWritable = isWritable;
exports.list = list;
exports.makeDirectory = makeDirectory;
exports.move = move;
exports.lastModified = lastModified;
exports.openRaw = openRaw;
exports.remove = remove;
exports.removeDirectory = removeDirectory;
exports.size = size;
exports.touch = touch;
exports.symbolicLink = symbolicLink;
exports.hardLink = hardLink;
exports.readLink = readLink;
exports.isLink = isLink;
exports.same = same;
exports.sameFilesystem = sameFilesystem;
exports.iterate = iterate;
exports.Permissions = Permissions;
exports.owner = owner;
exports.group = group;
exports.changePermissions = changePermissions;
exports.changeOwner = changeOwner;
exports.changeGroup = changeGroup;
exports.permissions = permissions;

And they will happy to parse our modules. There still be errors but at least, code completion worked accurately.

Tested with the latest NetBeans.

Please refactor your code to make our life easier. Thanks.

@botic
Copy link
Member

botic commented Jun 15, 2021

This will be shipped in Ringo 3.0.0 and already has been replaced in the current master.

@botic botic closed this as completed Jun 15, 2021
@ringo ringo locked and limited conversation to collaborators Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant