Browse Source

Fix the sorting object properties in the inspector

Fix #177

* indium-inspector.el (indium-inspector--split-properties): Do not reverse the
  order of properties.
* indium-render.el (indium-render-properties): Do not sort properties, use the
  order given by the runtime.
* server/adapters/cdp/index.js (getProperties): Use own properties
  only. Inherited properties can be accessed through the prototype object.
tags/2.0.0
Nicolas Petton 1 year ago
parent
commit
44bb3d9636
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
3 changed files with 12 additions and 16 deletions
  1. +9
    -8
      indium-inspector.el
  2. +2
    -6
      indium-render.el
  3. +1
    -2
      server/adapters/cdp/index.js

+ 9
- 8
indium-inspector.el View File

@@ -70,14 +70,15 @@

(defun indium-inspector--split-properties (properties)
"Split PROPERTIES into list where the first element is native properties and the second is the rest."
(seq-reduce (lambda (result property)
(push property
(if (indium-property-native-p property)
(car result)
(cadr result)))
result)
properties
(list nil nil)))
(let ((split (seq-reduce (lambda (result property)
(push property
(if (indium-property-native-p property)
(car result)
(cadr result)))
result)
properties
(list nil nil))))
(seq-map (lambda (list) (nreverse list)) split)))

(defun indium-inspector-pop ()
"Go back in the history to the last object inspected."


+ 2
- 6
indium-render.el View File

@@ -100,12 +100,8 @@ ACTION should be a function that takes no argument."
(insert (format " %s" (indium-remote-object-preview obj))))))

(defun indium-render-properties (properties)
"Insert all items in PROPERTIES sorted by name."
(seq-map #'indium-render-property
(seq-sort (lambda (p1 p2)
(string< (indium-property-name p1)
(indium-property-name p2)))
properties)))
"Insert all items in PROPERTIES."
(seq-map #'indium-render-property properties))

(defun indium-render-property (property &optional separator)
"Insert the PROPERTY rendered as a remote object.


+ 1
- 2
server/adapters/cdp/index.js View File

@@ -90,6 +90,7 @@ const getProperties = async (id) => {

let response = await state.client.Runtime.getProperties({
objectId: id,
ownProperties: true,
generatePreview: true
});

@@ -97,8 +98,6 @@ const getProperties = async (id) => {
name,
value: convertRemoteObject(value || get)
}));

return response.result;
};

const getCompletion = async ({expression, frameId}) => {


Loading…
Cancel
Save