Comments (22)
There's nothing that can be done until Microsoft (or someone) fixes microsoft/vscode#824.
from editorconfig-vscode.
Still much needed for VSCode!
I don't think there's another way to correctly managed encoding without it.
So please look at it.
from editorconfig-vscode.
monitor this
from editorconfig-vscode.
Nope.
from editorconfig-vscode.
@KUGA2 GitHub already shows it linked above. microsoft/vscode#824
from editorconfig-vscode.
Perhaps OP can be edited to encourage people (+friends & family) to go and upvote microsoft/vscode#824
from editorconfig-vscode.
I believe this is now possible with the files.encoding
setting?
from editorconfig-vscode.
If I'm not mistaken, we can't override the workspace settings of the user so this should be implemented in the API.
from editorconfig-vscode.
Ahh, you are correct.
from editorconfig-vscode.
Pinged them again to get the status on this API :)
from editorconfig-vscode.
@SamVerschueren can you reference (link to) the vscode issue here?
from editorconfig-vscode.
any progress?
from editorconfig-vscode.
Looking at vscodes source-code I found this (there's a feature to reopen a file with a different encoding):
vscode\src\vs\workbench\browser\parts\editor\editorStatus.ts:
return this.quickOpenService.pick(picks, {
placeHolder: isReopenWithEncoding ? nls.localize('pickEncodingForReopen', "Select File Encoding to Reopen File") : nls.localize('pickEncodingForSave', "Select File Encoding to Save with"),
autoFocus: { autoFocusIndex: typeof directMatchIndex === 'number' ? directMatchIndex : typeof aliasMatchIndex === 'number' ? aliasMatchIndex : void 0 }
}).then(encoding => {
if (encoding) {
activeEditor = this.editorService.getActiveEditor();
encodingSupport = toEditorWithEncodingSupport(activeEditor.input);
if (encodingSupport && encodingSupport.getEncoding() !== encoding.id) {
encodingSupport.setEncoding(encoding.id, isReopenWithEncoding ? EncodingMode.Decode : EncodingMode.Encode); // Set new encoding
}
}
});
toEditorWithEncodingSupport looks like this:
function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport {
// Untitled Editor
if (input instanceof UntitledEditorInput) {
return input;
}
// Side by Side (diff) Editor
if (input instanceof SideBySideEditorInput) {
const masterEncodingSupport = toEditorWithEncodingSupport(input.master);
const detailsEncodingSupport = toEditorWithEncodingSupport(input.details);
if (masterEncodingSupport && detailsEncodingSupport) {
return new SideBySideEditorEncodingSupport(masterEncodingSupport, detailsEncodingSupport);
}
return masterEncodingSupport;
}
// File or Resource Editor
let encodingSupport = input as IFileEditorInput;
if (types.areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
return encodingSupport;
}
// Unsupported for any other editor
return null;
}
Maybe this can be to some help. Could it be the necessary feature is there after all??
from editorconfig-vscode.
Throwing some more virtual balls:
Looking at vscode.d.ts
I found this function:
/**
* Get a workspace configuration object.
*
* When a section-identifier is provided only that part of the configuration
* is returned. Dots in the section-identifier are interpreted as child-access,
* like `{ myExt: { setting: { doIt: true }}}` and `getConfiguration('myExt.setting').get('doIt') === true`.
*
* When a resource is provided, configuration scoped to that resource is returned.
*
* @param section A dot-separated identifier.
* @param resource A resource for which the configuration is asked for
* @return The full configuration or a subset.
*/
export function getConfiguration(section?: string, resource?: Uri | null): WorkspaceConfiguration;
Example of usage:
const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri);
Could this be to any help?
from editorconfig-vscode.
@brainz80 your 2nd comment doesn't seem to have anything to do with encoding. The 1st one does, but those look like private methods, no?
from editorconfig-vscode.
@jedmao I guess your right. Looked a bit closer into the getConfiguration()
-function and it seems the only data that can be queried though it has to do with launch
and tasks
settings:
Note: Workspace and Workspace Folder configurations contains launch and tasks settings. Their basename will be part of the section identifier. The following snippets shows how to retrieve all configurations from launch.json
https://code.visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceConfiguration
As with the 1st comment they seem to be private methods; but maybe the logic in them could be to use?
I've tried to contact a couple of guys over at Microsoft with hopes of getting them to work on adding encoding support to the API. Unfortunately it seems they're more interested in working with their own bugs / feature-updates than taking on "user-reported" ones ... or so it seems at least.
from editorconfig-vscode.
I'd rather wait until they have a supported API for this feature.
from editorconfig-vscode.
Any news on this?
from editorconfig-vscode.
from editorconfig-vscode.
Is there a issue or request on vscode we could vote on?
from editorconfig-vscode.
This is an absolute must. I am working with some legacy stuff here that has no idea about utf-8
from editorconfig-vscode.
Any update on this?
Maybe some help needed?
from editorconfig-vscode.
Related Issues (20)
- Space indent size is not working in VSCode version 1.74 HOT 3
- after restart vscode, the opened file in view is not work at the beginning HOT 1
- `indent_size` overrides `tab_size` for tab characters HOT 2
- VSCode Makefile `spaces` not converted to `tab` on save HOT 1
- editoconfig doesn't work on mac HOT 2
- `insert_final_newline = false` not working HOT 6
- editorconfig was forcing up changes
- Feature request: `trim_trailing_whitespace` only on modified lines
- csharp_new_line_before_open_brace not working
- Feature request: Ability to set a .editorconfig to use
- Plugin is disabled when using an SSH FS workspace
- It is non-obvious when editorconfig is overriding my chosen tab/indent settings
- auto input enter
- Removes spaces in template literal strings (JS/TS)
- EditorConfig doesn't work well in VSCode (in specific files) HOT 1
- Feature request: Disable automatic cursor transfer when adding the last line. HOT 3
- Impossible to manually change indent style/size HOT 1
- insert_final_newline will open all files when using `Search & Replace`
- recoil doesn't work HOT 1
- cursor jumps to next line while writing
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 editorconfig-vscode.