SublimeText / AFileIcon

Sublime Text File-Specific Icons for Improved Visual Grepping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zzz A File Icon zzz Languages

IPWright83 opened this issue · comments

Is there a way to remove or disable the syntax used by the zzz A File Icon zzz package? The majority of the time when I open up a file a test file is seems to use the UnitTest (JavaScript) syntax highlighter which unfortunately breaks all the highlighting in the file.

I've tried switching over to JavaScript (Babel) for all files, but each time I open a new .test.js file, it always uses this highlighter by default.

Expected Behavior

SublimeText respects the syntax highlighter that I've selected

Current Behavior

Whenever I open a file, it always uses the UnitTest (JavaScript) syntax.

Steps to Reproduce (for bugs)

  1. Create a file called mytest.test.js
  2. Add some code in using syntax that requires the babel highlighter
describe('StackScreen', () => {
    it('renders correctly', async () => {
        let root;

        const PlaceHolder = () => <Text>Test Component</Text>;

        act(() => {
            root = create(<StackScreen name="test" component={PlaceHolder} />);
        });

        expect(root.toJSON()).toMatchSnapshot();
    });
});

  1. Change sublimes default to use the Babel syntax (View->Syntax->Open all with extension->Babel->JavaScript (Babel)
  2. Close the file
  3. Re-open the file

Context

Makes it hard to work with file with non standard JavaScript syntax (e.g. JSX)

Your Environment

Ubuntu 20.04, SublimeText 3.2.2 Build 3211

The Unittest (JavaScript) alias syntax includes source.js, which uses whatever syntax definition file which defines it. If default JavaScript and Babel are present and enabled at the same time, I don't know which one wins as both define the same scope. If Babel provides JSX syntax it should probably define source.jsx and proper file extensions would be *.jsx or *.test.jsx respectivly.

Note: A File Icon mapps all *.jsx extensions to source.jsx scope which is the default JSX syntax of ST4 and said much more accurate than Babel.

The reason why "Open all with Extension" doesn't work is ST recognizing the part after the very last dot as file extension only.

The syntax specific settings file for Babel (Packages/User/Babel.sublime-settings) therefore looks like:

{
	"extensions":
	[
		"js"
	]
}

while it would need the "test.js" being present as well:

{
	"extensions":
	[
		"js",
		"test.js"
	]
}

Besides adding the value manually, which is not very convinient, the only current workaround was to disable alias syntaxes.

You may alse try to disable the default JavaScript syntax, but I haven't checked consequences.

The only other idea I have is to create a setting with a blacklist of unwanted alias syntaxes.

Thanks, I'll have a play tomorrow. I can't use the JSX extension as we don't do that by default in our codebase and it's be a lot of changes!