| 2850 | } |
| 2851 | |
| 2852 | public registerFeature(feature: StaticFeature | DynamicFeature<any>): void { |
| 2853 | this._features.push(feature); |
| 2854 | if (DynamicFeature.is(feature)) { |
| 2855 | let messages = feature.messages; |
| 2856 | if (Array.isArray(messages)) { |
| 2857 | for (let message of messages) { |
| 2858 | this._method2Message.set(message.method, message); |
| 2859 | this._dynamicFeatures.set(message.method, feature); |
| 2860 | } |
| 2861 | } else { |
| 2862 | this._method2Message.set(messages.method, messages); |
| 2863 | this._dynamicFeatures.set(messages.method, feature); |
| 2864 | } |
| 2865 | } |
| 2866 | } |
| 2867 | |
| 2868 | protected registerBuiltinFeatures() { |
| 2869 | this.registerFeature(new ConfigurationFeature(this)); |