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

Some editor settings are not being respected by language #19511

Closed
sandy081 opened this issue Jan 27, 2017 · 12 comments
Closed

Some editor settings are not being respected by language #19511

sandy081 opened this issue Jan 27, 2017 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded
Milestone

Comments

@sandy081
Copy link
Member

Following settings are not getting update by language

editor.tabSize
editor.insertSpaces
editor.detectIndentation
editor.trimAutoWhitespace
@sandy081 sandy081 self-assigned this Jan 27, 2017
@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug workbench important Issue identified as high-priority labels Jan 27, 2017
@sandy081 sandy081 added this to the January 2017 milestone Jan 27, 2017
@sandy081
Copy link
Member Author

Above settings comes from the Model and are created/updated by the modelService. Fixing this need adoption in modelService to language based changes to configurations.

@sandy081 sandy081 added the candidate Issue identified as probable candidate for fixing in the next release label Jan 27, 2017
sandy081 added a commit that referenced this issue Jan 30, 2017
 - model creation options can now be specified at a later stage
sandy081 added a commit that referenced this issue Jan 30, 2017
 - model creation options can now be specified at a later stage
sandy081 added a commit that referenced this issue Jan 30, 2017
 - model creation options can now be specified at a later stage
@bpasero bpasero added the verified Verification succeeded label Jan 31, 2017
@sandy081 sandy081 modified the milestones: February 2017, January 2017 Jan 31, 2017
@sandy081
Copy link
Member Author

sandy081 commented Jan 31, 2017

We decided to revert this fix from 1.9 release because, Current code is not ready to provide a simple fix for this. This needs quiet amount of refactoring

  • Model service has to be adopted to language based settings
  • Model builder and its callers has to be refactored and adopted to language based settings. Core of the problem is that Model builder consumes config options to create IRawText which is an input for creating a Model. Since, config options are independent of language there were no issues. But from now, they are dependent on language. To get language we either need file URI and file first line. First line is not available until Model Builder builds IRawText. So it is a chicken-egg problem which needs proper split of IRawText to IConfigurationUnawareRawText. And, Model builder spits this new IConfigurationUnawareRawText and the Model Service can create the model from this IConfigurationUnawareRawText and the language.

This from an implementation perspective a feature by itself and is risky to implement this at the very end of 1.9. Hence we decided to revert this fix and make this available in February release.

So long story short, in 1.9 release, users cannot configure above described settings by language. This will be available in latest insiders and from next stable release.

@sandy081 sandy081 reopened this Jan 31, 2017
@sandy081 sandy081 removed the verified Verification succeeded label Jan 31, 2017
sandy081 added a commit that referenced this issue Jan 31, 2017
sandy081 added a commit that referenced this issue Jan 31, 2017
- Wraps processed information from file
- Helper methods in TextModel to create RawText
@sandy081 sandy081 removed the candidate Issue identified as probable candidate for fixing in the next release label Jan 31, 2017
@ghost
Copy link

ghost commented Feb 6, 2017

Maybe files.exclude should be added to the list, I'm getting "Unknown identifier. Use language identifiers" trying to set under Python settings.

@sandy081
Copy link
Member Author

sandy081 commented Feb 6, 2017

@mdalpi Please let me know the use case behind supporting files.exclude in the list? Also please create a separate issue for that. Thanks.

@ghost
Copy link

ghost commented Feb 6, 2017

@sandy081 I'll use just to ignore cache files (*.pyc files and __pycache__ folder specifically). Of course I can do with the global setting just fine, I just thought that this would be possible. We should wait for others to create an issue about this (maybe I'm the only trying this particular case). Thanks.

@kristianmandrup
Copy link

I'm currently unable to avoid auto-save indentation of 4 spaces for my .js files.
I tried everything. Disabled all linter extensions. Configuring .vscode/settings.json

{
    "vsicons.presets.angular": false,
    "editor.tabSize": 2,
    "editor.detectIndentation": false,
    "editor.formatOnSave": false
}

Added the same for my preferences/user settings file:

// Place your settings in this file to overwrite the default settings
{
    "editor.tabSize": 2,
    "editor.detectIndentation": false,
    "editor.formatOnSave": false,
    "typescript.check.tscVersion": false,
    "window.zoomLevel": 0,
    "files.trimTrailingWhitespace": true,
    "npm.validate.enable": false,
    "editor.minimap.enabled": true,
    "workbench.iconTheme": "vscode-icons",
    "[javascript]": {
        "editor.tabSize": 2
    }
}

Still it auto-indents on every save to 4 spaces! Is there any way to get around this on the current release? Or is it some extension playing tricks on me?

@sandy081
Copy link
Member Author

sandy081 commented Mar 7, 2017

@kristianmandrup You can try disabling all extensions, with vanilla VS Code, do following

  • Have empty .vscode/settings.json
  • In user settings have following
"editor.detecetIndentation": false,
"editor.tabSize": 2

Above user settings will have tab size to 2 for all files. To do just for javascript files have following in user settings

"[javascript]": {
"editor.detecetIndentation": false,
"editor.tabSize": 2
}

Let me know if above works for you?

@kristianmandrup
Copy link

This is exactly what I tried (see above), except disabling all my extensions. Thanks anyways.

@sandy081
Copy link
Member Author

sandy081 commented Mar 7, 2017

can you try disabling extensions and see if it works?

@kristianmandrup
Copy link

Turned out the vscode-JS-CSS-HTML-formatter extension was to blame. Solved now! Thanks

@ryenus
Copy link
Contributor

ryenus commented Aug 20, 2017

I just encountered the same trap, and @kristianmandrup is right.
For those installed JS-CSS-HTML Formatter extension, please check Formatter Config (via Command Palette), especially, the following (default) settings:

"javascript": {
  "indent_size": 4,
  "end_with_newline": true
  // ...
}

@Earl-Brown
Copy link

@sandy081 - the editor.detectIndentation trick worked for me. Thanks!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants