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

Tons of workspace/configuration requests #2062

Closed
rchl opened this issue Oct 25, 2022 · 2 comments
Closed

Tons of workspace/configuration requests #2062

rchl opened this issue Oct 25, 2022 · 2 comments

Comments

@rchl
Copy link
Collaborator

rchl commented Oct 25, 2022

Volar requests configuration through workspace/configuration very frequently. For example here we have 8 requests in succession.

:: <-- LSP-volar workspace/configuration(290): {'items': [{'section': 'volar.diagnostics.delay'}]}
:: >>> LSP-volar 290: [200]
:: <<< LSP-volar 167: None
:: <<< LSP-volar 169: []
:: <-- LSP-volar workspace/configuration(291): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 291: [True]
:: <-- LSP-volar workspace/configuration(292): {'items': [{'section': 'javascript.format', 'scopeUri': 'file:///usr/local/workspace/temp/volar-vue2-test/pages/index.vue.js'}]}
:: >>> LSP-volar 292: [None]
:: <-- LSP-volar workspace/configuration(293): {'items': [{'section': 'javascript', 'scopeUri': 'file:///usr/local/workspace/temp/volar-vue2-test/pages/index.vue.js'}]}
:: >>> LSP-volar 293: [{'inlayHints': {'parameterNames': {'suppressWhenArgumentMatchesName': True, 'enabled': 'none'}, 'propertyDeclarationTypes': {'enabled': False}, 'parameterTypes': {'enabled': False}, 'functionLikeReturnTypes': {'enabled': False}, 'enumMemberValues': {'enabled': False}, 'variableTypes': {'enabled': False, 'suppressWhenTypeMatchesName': {'enabled': True}}}}]
:: <-- LSP-volar workspace/configuration(294): {'items': [{'section': 'volar.codeLens.pugTools'}]}
:: >>> LSP-volar 294: [False]
:: <-- LSP-volar workspace/configuration(295): {'items': [{'section': 'javascript.preferences', 'scopeUri': 'file:///usr/local/workspace/temp/volar-vue2-test/pages/index.vue.js'}]}
:: >>> LSP-volar 295: [None]
:: <-- LSP-volar workspace/configuration(296): {'items': [{'section': 'volar.codeLens.scriptSetupTools'}]}
:: >>> LSP-volar 296: [False]
:: <<< LSP-volar 171: <params with 12941 characters>
:: <-- LSP-volar workspace/configuration(297): {'items': [{'section': 'volar.codeLens.scriptSetupTools'}]}
:: >>> LSP-volar 297: [False]
:: <<< LSP-volar 170: []
:: <<< LSP-volar 166: <params with 9905 characters>
:: <<< LSP-volar 168: {'resultId': '1666694322621', 'data': [4, 18, 5, 9, 1, 8, 2, 4, 9, 1, 1, 2, 4, 14, 1, 3, 6, 3, 9, 1]}
:: <-  LSP-volar textDocument/publishDiagnostics: {'uri': 'file:///usr/local/workspace/temp/volar-vue2-test/pages/index.vue', 'diagnostics': [], 'version': 0}

It's not an issue in itself but it seems quite inefficient.

I think Volar could cache the configuration and rely on didChangeConfiguration to invalidate the cache.

Note that my suggestion wouldn't work for cases where Volar asks for configuration for specific URI but I'm not really sure that needs to be supported and that people really expect to be able to override configuration per URI.

Also note that the requests that fetch configuration for specific URIs pass the URI of virtual/generated file (for example ../pages/index.vue.js) and not of the actual file (..pages/index.vue) so it's even less likely that anyone is relying on that functionality right now.

@rchl
Copy link
Collaborator Author

rchl commented Dec 22, 2022

This is on v1.0.16 with many vue files open:

:: <-- LSP-volar workspace/configuration(4): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 4: [None]
:: <<< LSP-volar 3: {'data': [4, 24, 8, 14, 0, 5, 27, 8, 14, 0, 0, 9, 8, 9, 0, 2, 27, 8, 14, 0, 0, 9, 8, 9, 0, 2, 30, 8, 14, 0, 0, 9, 11, 9, 0, 0, 16, 11, 14, 0, 0, 12, 8, 14, 0, 0, 9, 11, 9, 0, 0, 15, 8, 9, 1, 4, 27, 8, 14, 0, 0, 9, 5, 9, 0, 1, 42, 8, 14, 0, 0, 9, 13, 9, 0, 0, 20, 10, 14, 0, 0, 44, 2, 14, 0, 1, 47, 5, 14, 0, 0, 6, 21, 9, 0, 6, 36, 10, 14, 0, 0, 53, 2, 14, 0, 1, 36, 10, 14, 0, 0, 72, 2, 14, 0, 6, 50, 8, 14, 0, 0, 9, 7, 9, 0, 0, 11, 11, 9, 0, 0, 28, 11, 9, 0, 2, 27, 8, 14, 0, 0, 9, 13, 9, 0, 0, 18, 13, 14, 0, 1, 26, 3, 9, 1, 0, 31, 6, 9, 1, 0, 10, 4, 9, 1, 0, 6, 14, 14, 0, 0, 15, 8, 14, 0, 0, 9, 9, 9, 0, 4, 49, 8, 14, 0, 3, 29, 10, 14, 0, 2, 24, 2, 14, 0, 2, 31, 8, 14, 0, 0, 9, 7, 9, 0, 0, 12, 8, 14, 0, 0, 9, 12, 9, 0, 0, 13, 16, 9, 0, 1, 29, 10, 14, 0, 2, 24, 2, 14, 0, 12, 4, 4, 9, 1, 1, 4, 10, 9, 1, 1, 10, 9, 14, 65, 0, 12, 4, 7, 1, 0, 6, 3, 7, 1, 0, 5, 5, 7, 1, 2, 14, 8, 8, 5, 0, 11, 5, 7, 0, 0, 6, 5, 9, 4, 2, 13, 8, 8, 4, 1, 19, 3, 7, 0, 0, 4, 17, 14, 0, 4, 12, 11, 9, 1, 0, 13, 8, 8, 4, 0, 9, 7, 9, 0, 0, 16, 4, 7, 0, 0, 5, 4, 9, 0, 0, 5, 17, 14, 0, 3, 4, 4, 14, 1, 3, 12, 11, 9, 1, 3, 4, 4, 14, 1, 2, 12, 5, 9, 1, 0, 12, 2, 14, 0, 3, 4, 8, 9, 1, 2, 8, 8, 14, 1, 1, 24, 6, 9, 0, 0, 7, 5, 9, 4, 3, 8, 13, 14, 1, 1, 19, 7, 1, 512, 0, 13, 8, 14, 0, 0, 10, 13, 9, 0, 0, 22, 8, 14, 0, 0, 9, 9, 9, 0, 0, 14, 10, 8, 4, 2, 8, 5, 14, 1, 1, 21, 21, 9, 1, 3, 4, 7, 9, 1, 1, 8, 14, 14, 1], 'resultId': '1671749898395'}
:: <-- LSP-volar workspace/configuration(5): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 5: [True]
:: <-- LSP-volar workspace/configuration(6): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 6: [True]
:: <-- LSP-volar workspace/configuration(7): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 7: [None]
:: <-- LSP-volar workspace/configuration(8): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 8: [None]
:: <-- LSP-volar workspace/configuration(9): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 9: [True]
:: <-- LSP-volar workspace/configuration(10): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 10: [True]
:: <-- LSP-volar workspace/configuration(11): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 11: [None]
:: <-- LSP-volar workspace/configuration(12): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 12: [None]
:: <-- LSP-volar workspace/configuration(13): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 13: [True]
:: <-- LSP-volar workspace/configuration(14): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 14: [True]
:: <-- LSP-volar workspace/configuration(15): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 15: [None]
:: <-- LSP-volar workspace/configuration(16): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 16: [None]
:: <-- LSP-volar workspace/configuration(17): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 17: [True]
:: <-- LSP-volar workspace/configuration(18): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 18: [True]
:: <-- LSP-volar workspace/configuration(19): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 19: [None]
:: <-- LSP-volar workspace/configuration(20): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 20: [None]
:: <-- LSP-volar workspace/configuration(21): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 21: [True]
:: <-- LSP-volar workspace/configuration(22): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 22: [True]
:: <-- LSP-volar workspace/configuration(23): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 23: [None]
:: <-- LSP-volar workspace/configuration(24): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 24: [None]
:: <-- LSP-volar workspace/configuration(25): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 25: [True]
:: <-- LSP-volar workspace/configuration(26): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 26: [True]
:: <-- LSP-volar workspace/configuration(27): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 27: [None]
:: <-- LSP-volar workspace/configuration(28): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 28: [None]
:: <-- LSP-volar workspace/configuration(29): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 29: [True]
:: <-- LSP-volar workspace/configuration(30): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 30: [True]
:: <-- LSP-volar workspace/configuration(31): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 31: [None]
:: <-- LSP-volar workspace/configuration(32): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 32: [None]
:: <-- LSP-volar workspace/configuration(33): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 33: [True]
:: <-- LSP-volar workspace/configuration(34): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 34: [True]
:: <-- LSP-volar workspace/configuration(35): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 35: [None]
:: <-- LSP-volar workspace/configuration(36): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 36: [None]
:: <-- LSP-volar workspace/configuration(37): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 37: [True]
:: <-- LSP-volar workspace/configuration(38): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 38: [True]
:: <<< LSP-volar 47: None
:: <-- LSP-volar workspace/configuration(39): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 39: [None]
:: <-- LSP-volar workspace/configuration(40): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 40: [True]
:: <-- LSP-volar workspace/configuration(41): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 41: [True]
:: <-- LSP-volar workspace/configuration(42): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 42: [None]
:: <-- LSP-volar workspace/configuration(43): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 43: [None]
:: <-- LSP-volar workspace/configuration(44): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 44: [True]
:: <-- LSP-volar workspace/configuration(45): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 45: [True]
:: <<< LSP-volar 57: None
:: <-- LSP-volar workspace/configuration(46): {'items': [{'section': 'css.customData'}]}
:: >>> LSP-volar 46: [None]
:: <-- LSP-volar workspace/configuration(47): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 47: [True]
:: <-- LSP-volar workspace/configuration(48): {'items': [{'section': 'volar.codeLens.references'}]}
:: >>> LSP-volar 48: [True]
:: <-- LSP-volar workspace/configuration(49): {'items': [{'section': 'html.customData'}]}
:: >>> LSP-volar 49: [None]
:: <-- LSP-volar workspace/configuration(50): {'items': [{'section': 'volar.codeLens.pugTools'}]}
:: >>> LSP-volar 50: [False]
:: <-- LSP-volar workspace/configuration(51): {'items': [{'section': 'volar.codeLens.pugTools'}]}
:: >>> LSP-volar 51: [False]

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Dec 23, 2022

css.customData do no caching because it's response null, it's fixed by 6220c4b.

But I don't know why volar.codeLens.references do no caching, ??= should not catch True / False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants