vim-js-file-import
vim-js-file-import copied to clipboard
Sorting multiline imports not working
This block of imports after sort has syntax issues
Before:
import * as R from 'ramda';
import DeviceSettings from 'react-native-device-settings';
import fs from 'react-native-fs';
import moment from 'moment-timezone';
import MPEGRemuxer from 'react-native-ts-to-mp4';
import Permissions from 'react-native-permissions';
import Result from 'folktale/result';
import {
call,
fork,
put,
race,
select,
take,
takeEvery,
} from 'redux-saga/effects';
import { eventChannel, channel, buffers, type Effect } from 'redux-saga';
import { Sentry } from 'react-native-sentry';
After:
call,
fork,
put,
race,
select,
take,
takeEvery,
import * as R from 'ramda';
import DeviceSettings from 'react-native-device-settings';
import fs from 'react-native-fs';
import moment from 'moment-timezone';
import MPEGRemuxer from 'react-native-ts-to-mp4';
import Permissions from 'react-native-permissions';
import Result from 'folktale/result';
import {
import { eventChannel, channel, buffers, type Effect } from 'redux-saga';
import { Sentry } from 'react-native-sentry';
} from 'redux-saga/effects';
Yeah implementation is very bare and simple, it behaves well only on full imports. Needs improvement.
(Just started using this plugin, greatk work @kristijanhusak!)
Maybe it makes sense to remove the sorting functionality, since it has been superseded by other plugins and make the core functionality simpler to manage?
Hey @panosl,
I agree that it's nowhere near perfect, but why would we remove it?
It's not being used unless specifically requested to via mapping or a opt in variable.
I'm not saying you should. It just feels like it's outside of the core functionality of vim-js-file-import
. Unless you plan to improve it further.
p.s. Still the automatic import functionality works like a charm, really happy that I stumbled on this. I was so jealous when I saw it on VS Code!
Yeah it's not it's main functionality. I added it for my needs, since I work with some old node js applications that still use commonjs, and I didn't found any plugin or lsp that would sort require's properly.
I think this even handles some cases that VS code cannot handle :)