AngularDoc / angulardoc.github.io

angulardoc.github.io web site
https://angulardoc.github.io
34 stars 2 forks source link

Storing state / default settings in .vscode/settings.json #5

Closed dopry closed 7 years ago

dopry commented 7 years ago

I noticed angular doc has started modifying my .vscode/settings.json on all of my projects. As a team we use VS Code and share our settings via git. I'd much rather it didn't alter our settings.json. None of the other extensions we use do this.

agiledigits commented 7 years ago

We used to have our own config file in .vscode/angulardoc.json, but a few releases later VS Code stopped treating it as one of the setting files and our extension wouldn't get the file change notification any more.

dopry commented 7 years ago

I saw that change, but currently you're writing default values into the config file that could stay in your extension.

out of

{
    "angulardoc.repoId": "********-****-****-*************",
    "angulardoc.directoryFilter": [
        "!typings",
        "!node_modules",
        "!.vscode"
    ],
    "angulardoc.fileFilter": [
        "**/!(*.*spec).ts"
    ],
    "angulardoc.lastSync": 0
}

repoId and lastSync look like internal extension state, not configuration. fileFilter and directoryFilter look like default values you can keep in your extension.

It would be nice if you stored the extension state somewhere else, and didn't write defaults to the config file, but allowed developers to choose to override them from their config files.

not writing defaults will allow you to update them as you see fit over time. As long as you're writing them to the config, if you change them in the future you will run the risk of overwriting someone's custom configuration.

mlc-mlapis commented 7 years ago

@agiledigits We also have a problem with changes in settings.json because it is the file that is included in GitHub repo = sharing our team project's setting. It is really necessary to find a different place to store the extension config data.

mlc-mlapis commented 7 years ago

@agiledigits Is there anything new? The fact that settings.json is used for storing is really a serious problem. In reality it is very difficult to use AngularDoc with this behaviour ... if there are more devs on the project than one!!!

agiledigits commented 7 years ago

@mlc-mlapis We are actively working on a new solution which I believe will provide a superior user experience and richer features. Please stay tuned.

mlc-mlapis commented 7 years ago

Thanks a lot for any solution, even temporary.

agiledigits commented 7 years ago

We have published v2.2.0 which moved the angulardoc settings from "settings.json" to the restored "angulardoc.json" file. Please try it and let us know what happens.

mlc-mlapis commented 7 years ago

Thanks for news but I am a bit lost. I uninstall, reinstall ... AngularDoc ext several times but nothing runs in the end. Nothing as AngularDoc on the status bar.

If I try to invoke ngdoc the a message command 'ngdoc' not found appears.

I have VSC 1.12.2 on Windows 8.1 and AngularDoc 2.2.0 installed. So there is certainly a problem.

I have params in my personal settings.json file as:

...
"angulardoc.email": "xxx@xxx.xx",
"angulardoc.access_token": "",
"angulardoc.username": "xxx@xxx.xx",
"angulardoc.directoryFilter": [
    "!typings",
    "!node_modules",
    "!.vscode"
],
"angulardoc.fileFilter": [
    "**/!(*.*spec).ts"
],
...

and I have empty file angulardoc.json in .vscode directory.

agiledigits commented 7 years ago

It sounds like the extension wasn't activated. The first thing I'd check is whether there's package.json file in the root directory as we won't activate the extension for non-angular projects.

mlc-mlapis commented 7 years ago

Hmmm, it is here for sure. But from this point of view, Angular 4.2.0-beta.1 is installed. Do you think that this is the problem?

agiledigits commented 7 years ago

We look for "angular/core" in dependencies.

mlc-mlapis commented 7 years ago

Hmmm, I have the following, so that looks enough ...

...
"dependencies": {
    "systemjs": "0.20.12",
    "core-js": "2.4.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.4.0",
    "zone.js": "0.8.10",
    "@angular/core": "4.2.0-beta.1",
    "@angular/common": "4.2.0-beta.1",
    "@angular/compiler": "4.2.0-beta.1",
    "@angular/compiler-cli": "4.2.0-beta.1",
    "@angular/platform-server": "4.2.0-beta.1",
    "@angular/platform-browser": "4.2.0-beta.1",
    "@angular/platform-browser-dynamic": "4.2.0-beta.1",
    "@angular/platform-webworker": "4.2.0-beta.1",
    "@angular/platform-webworker-dynamic": "4.2.0-beta.1",
    "@angular/language-service": "4.2.0-beta.1",
    "@angular/http": "4.2.0-beta.1",
    "@angular/forms": "4.2.0-beta.1",
    "@angular/router": "4.2.0-beta.1",
    "@angular/animations": "4.2.0-beta.1",
    "@ngrx/core": "1.2.0",
    "@ngrx/store": "2.2.2",
    "primeng": "4.0.0",
    "raven-js": "3.15.0",
    "runtime-type-checks": "0.0.4"
},
...
agiledigits commented 7 years ago

Could it be that you don't have tsconfig.json or angular-cli.json files? We made a small patch to deal with that situation.

mlc-mlapis commented 7 years ago

Thanks. I tried to install version 2.2.1. But nothing changed. Still any using of ngdoc or any of ng g .... ends with a warningcommand 'ngdoc' not found or command 'ng.xxx' not found. So the small patch doesn't have any effect. It has to be probably something else.

I have tsconfig.json file ... as it is working Angular's project (even previously it was) based on using SystemJS. I have installed also Angular CLI 1.0.3 globally but the project is not CLI project so I don't have angular-cli.json. But I didn't have it before also and AngularDoc has been working (2.1.0).

I checked and xxx\.vscode\extensions\AngularDoc.angulardoc-vscode-2.2.1 exists in a user directory.

I also tried to switch Angular to version 4.1.2 in the projet and repeat uninstall/install but without any effect.

agiledigits commented 7 years ago

Any chance you are not using the latest VS Code?

mlc-mlapis commented 7 years ago

No, I am using the latest VSC: 1.12.2

I tried the same ^^ on the second PC where Windows 10 is installed and the same project repository. The behavior is exactly the same. So the problem has to be a general one. I can't see any message, just nothing.

dopry commented 7 years ago

I am using VSC 1.12.2 w/AngularDoc 2.2.1 with Node 7.4.

The generate commands are in my context menu, but do nothing. I don't have an icon to open the docs. If I try to run ngdoc from the command palette, i get the error message "command 'ngdoc' not found".

mlc-mlapis commented 7 years ago

@dopry ... so exactly the same behaviour, I think.

agiledigits commented 7 years ago

Could it be that you have multiple node_modules where package.json files are found? If so, please try v2.2.2 that we just released.

mlc-mlapis commented 7 years ago

@agiledigits How do you mean that? The directory node_modules in the project root contains other modules ... nested and each of them contains also package.json file but it is normal, isn't it?

I tried to install version 2.2.2 but there is no difference. Still the same situation as with previous versions.

agiledigits commented 7 years ago

There was a chance that we might be looking in the wrong package.json file for the angular dependencies. However the patch didn't fix your issue, and I'm running out of ideas. Perhaps you can try the sample repo https://github.com/mgechev/angular-seed/ and see if it works.