Comments (5)
The reason why the plugin adds the encoding declaration again is that it will always be sure that the encoding declaration are present when needed, and that it's never present when not needed. So if you delete it, and the plugin adds it again, the declaration is still needed, and it should not be removed as long as the file still has non-ASCII characters.
And personally I prefer this approach than add it just once. The reason why I've created this plugin is to delegate to it the task of adding and removing the encoding declaration. So when I'm using it I don't want to think about encoding declaration, this is the plugin's job.
from auto-encoding-for-ruby.
Ok. But one moment. If file already has encoding header - plugin try adds own header. May be, plugin should check presence of encoding header, before adds right header, or replace existing.
And how plugin work, when in file using hashbang header? (#! /env/ruby for example)
from auto-encoding-for-ruby.
The plugin already checks if the file has an encoding declaration, but it checks using the default encoding declaration (currently #encoding: utf-8). So If you're using an encoding declaration other than the default, the plugin will add the declaration anyway. In this case you have to set your prefered encoding declaration string, as explained here: https://github.com/elomarns/auto-encoding-for-ruby#encoding-declaration. After this, the plugin will recognize your encoding declaration.
About hashbang headers, the plugin currently ignores it and always add the encoding declaration on the first line. I didn't thought on this case before, and I agree that's not the best behaviour. So I'll eventually change it in a way that it adds the encoding declaration on the first blank line.
from auto-encoding-for-ruby.
Ok. =) I start experiment with analog your plugin for looking on this task, and I think about solving problem with hashbang headers. May be I can come up with some useful solution.
from auto-encoding-for-ruby.
Good look. :)
I'll eventually try to solve the hashbang problem as well.
from auto-encoding-for-ruby.
Related Issues (12)
- Support other Ruby-like syntaxes like RSpec HOT 5
- Stay below shebang line HOT 1
- sublime 3 compatibility HOT 1
- Doesn't work with Sublime Text 3? HOT 2
- UTF-8 declaration style HOT 2
- Does not come up in Package Control: Install Package - When will it be available for ST3? HOT 3
- Breaks Haml files HOT 3
- Wrong coding header generated by the plugin HOT 3
- Adding encoding header in SLIM templates HOT 5
- Check encoding only on load and save HOT 3
- optionally do not remove encoding comment HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto-encoding-for-ruby.